Only on iOS : NullReferenceException at System.Nullable`1[T]..ctor / Rebuild cancels the exception

Jean-DanielGasserJean-DanielGasser CHMember ✭✭
edited November 7 in Xamarin.Forms

Hello,
I'm working on a Xamarin.Forms application. It works well on Android and UWP, but when I want to debug the App on iOS, the application throws a NullReferenceException at startup.

The strange thing is if I rebuild the application and then re-run in debug mode then the exception disappears and I can use the app without any issue.

Here is the detail of the exception:
System.NullReferenceException: Object reference not set to an instance of an object at System.Nullable'1[T]..ctor (System.Double value) <0x25f43dc + 0x00034> 32235 in <7b5faf4072934b65b9f50c81038269d3#93882ad40629bb89e9b0a603b7ebadfc>:0 at CBS_CBT.Polux.Forms.ctrlSigmaGauge.OnOrangeSigmaPropertyChanged (Xamarin.Forms.BindableObject p_objBindable, System.Object p_objOldValue, System.Object p_objNewValue) [0x00055] in C:\Users\Gasser\Desktop\PoluxXAM\Polux\CBS_CBT.Polux\Forms\ctrlSigmaGauge.cs:261 at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:596 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:390 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0005f] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:543 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:83 at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.TrySetValue (System.Object element, Xamarin.Forms.BindableProperty property, System.Boolean attached, System.Object value, System.Xml.IXmlLineInfo lineInfo, Xamarin.Forms.Xaml.Internals.XamlServiceProvider serviceProvider, System.Exception& exception) [0x000f2] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:446 at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydratationContext context, System.Xml.IXmlLineInfo lineInfo) [0x00077] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:326 at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00070] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:58 at Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:86 at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00043] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:143 at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:145 at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:145 at Xamarin.Forms.Xaml.ListNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00025] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:227 at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00043] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:201 at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydratationContext visitorContext) [0x0007b] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:141 at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) [0x0004b] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:89 at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x0002f] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:68 at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in <6ebc9f23a7364f10a880da9caa555539>:0 at TestPolux.Views.pgeMain.InitializeComponent () [0x00001] in C:\Users\Gasser\Desktop\PoluxXAM\TestPolux\TestPolux\obj\Debug\TestPolux.Views.pgeMain.xaml.g.cs:67 at TestPolux.Views.pgeMain..ctor () [0x00046] in C:\Users\Gasser\Desktop\PoluxXAM\TestPolux\TestPolux\Views\pgeMain.xaml.cs:66 at TestPolux.App..ctor () [0x0000f] in C:\Users\Gasser\Desktop\PoluxXAM\TestPolux\TestPolux\App.xaml.cs:12 at TestPolux.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x0000d] in C:\Users\Gasser\Desktop\PoluxXAM\TestPolux\TestPolux.iOS\AppDelegate.cs:25 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5481/12e80e01/source/xamarin-macios/src/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5481/12e80e01/source/xamarin-macios/src/UIKit/UIApplication.cs:63 at TestPolux.iOS.Application.Main (System.String[] args) [0x00002] in C:\Users\Gasser\Desktop\PoluxXAM\TestPolux\TestPolux.iOS\Main.cs:14 The app has been terminated. Failed to Stop app: An error occured on client IDB471033 while executing a reply for topic xvs/idb/4.7.10.33/stop-app The app has been terminated.
Thank you in advance for your help.

Sign In or Register to comment.