Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Submitting bug report at Rolf's request from this forum discussion: http://forums.xamarin.com/discussion/comment/78210
The problem presented itself upon upgrading to Xamarin.iOS 8 and Xcode 6. It builds just fine, but when I run it on an iOS 8 simulator, it gives the following stacktrace:
2014-09-25 10:33:29.278 SimiiOS[19692:526074] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at System.String.memcpy4 (System.Byte* dest, System.Byte* src, Int32 size) [0x00005] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/String.cs:3044
at System.String.memcpy (System.Byte* dest, System.Byte* src, Int32 size) [0x0008e] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/String.cs:3136
at Simi.Core.iOS.Utilities.CoordinatesExtensions.PreDrawSetup (Simi.Core.iOS.Events.Rendering.PreFrameDrawEvent ev) [0x00007] in /Users/johnsogg/tmp/simi-for-xamarin/Code/SIMI/Simi.Core.iOS/Utilities/Coordinates.cs:110
at Simi.Core.iOS.Utilities.CoordinatesExtensions.RegisterHandlers () [0x00029] in /Users/johnsogg/tmp/simi-for-xamarin/Code/SIMI/Simi.Core.iOS/Utilities/Coordinates.cs:71
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object,System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114
at Simi.Core.iOS.Utilities.Binding.DelayedInvokeHelper.Invoke (DelayInvokeOrder invokeOrder) [0x00054] in /Users/johnsogg/tmp/simi-for-xamarin/Code/SIMI/Simi.Core.iOS/Utilities/Binding/DelayedInvoke.cs:43
at Simi.iOS.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x000be] in /Users/johnsogg/tmp/simi-for-xamarin/Code/SIMI/Simi.iOS/AppDelegate.cs:62
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string,intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
at MonoTouch.UIKit.UIApplication.Main (System.String args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
at Simi.iOS.Application.Main (System.String args) [0x00009] in /Users/johnsogg/tmp/simi-for-xamarin/Code/SIMI/Simi.iOS/Main.cs:15
My offending code (Coordinates.cs:110) has not changed for over a year. That line of code is simply copying variables (involving OpenTK Matrix objects). It has nothing to do with String, which is where the native exception is coming from.
Zoltan, this looks JIT-related, can you have a look?
I can reproduce it with monotouch/master, but only if the app was built using Xcode 6.0.1, it does not crash with Xcode 5.1.1.
The problem seems to be that Globals.Renderer is null in that method.
@Gabe, I get the same results, it looks like iOS doesn't invoke methods in the same order as before, causing Globals.Rendered to not become initialized when that crashing function is called.
Thanks. After Zoltan pointed out it was null, that was my first thought. I'll have to change the way things are initialized. I appreciate the extra eyes.
Even though my particular problem has been worked around, I still think you should address the mismatch between the actual error and the error message produced. The stacktrace indicates a problem deep down in a native library somewhere.
At any rate, thanks for the help!