else if (!type.GetTypeInfo().DeclaredConstructors.Any(ci => ci.IsPublic && ci.GetParameters().Length == 0) &&
!ValidateCtorArguments(type, node, out ctorargname))
{
- throw new XamlParseException($"The Property {ctorargname} is required to create a {type.FullName} object.", node);
+ throw new XamlParseException($"The Property {ctorargname} is required to create a {type?.FullName} object.", node);
}
else
{
(Func<TypeConverter>)null, serviceProvider);
}
- setter.Invoke(markupExtension, new[] { value });
+ setter?.Invoke(markupExtension, new[] { value });
}
}
}
\ No newline at end of file
if (opImplicit != null) {
//convert the OnPlatform<T> to T
var opPlatformImplicitConversionOperator = resource.GetType().GetImplicitConversionOperator(fromType: resource.GetType(), toType: tType);
- resource = opPlatformImplicitConversionOperator.Invoke(null, new[] { resource });
+ resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource });
//and convert to toType
resource = opImplicit.Invoke(null, new[] { resource });
try
{
_eventinfo = bindable.GetType().GetRuntimeEvent(Event);
- _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo.EventHandlerType, this);
+ _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo?.EventHandlerType, this);
}
catch (Exception)
{
handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, e.NewItems, outerNewIndex, outerOldIndex));
break;
case NotifyCollectionChangedAction.Remove:
- if (e.OldStartingIndex == -1 || e.OldItems.Count > 1)
+ if (e.OldStartingIndex == -1 || e.OldItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
var removedItem = e.OldItems[0] as TRestrict;
handler(this, args);
break;
case NotifyCollectionChangedAction.Replace:
- if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems.Count > 1)
+ if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
var newReplaceItem = e.NewItems[0] as TRestrict;
- var oldReplaceItem = e.OldItems[0] as TRestrict;
+ var oldReplaceItem = e.OldItems?[0] as TRestrict;
if ((newReplaceItem == null || !newReplaceItem.Owned) && (oldReplaceItem == null || !oldReplaceItem.Owned))
{
{
// Create the control
CustomView newControl = controlConstructor();
- return newControl.GetPtrfromView(); // return pointer to handle
+ if (newControl != null)
+ {
+ return newControl.GetPtrfromView(); // return pointer to handle
+ }
+ else
+ {
+ return IntPtr.Zero;
+ }
}
else
{
{
PropertyMap map = new PropertyMap();
ok = propValue.Get(map);
- if( ok )
+ if (ok)
{
- propertyInfo.SetValue( view, map );
+ propertyInfo.SetValue(view, map);
}
}
else if (type.Equals(typeof(PropertyArray)))
{
PropertyArray array = new PropertyArray();
ok = propValue.Get(array);
- if( ok )
+ if (ok)
{
- propertyInfo.SetValue( view, array );
+ propertyInfo.SetValue(view, array);
}
}
else
{
- throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName );
+ throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName);
}
if (!ok)
{
RealParent = value;
if (RealParent != null)
{
- OnParentResourcesChanged(RealParent.GetMergedResources());
+ OnParentResourcesChanged(RealParent?.GetMergedResources());
((IElement)RealParent).AddResourcesChangedListener(OnParentResourcesChanged);
}