iOS App Store ExecutionEngineException attempting to JIT compile - xamarin.ios

I have a really awkward problem. I have build my app for iOS and tested it on all emulators and it works fine. I have installed it on a device (iPhone 6 plus) and that works fine as well. However, when I submit it to the app store, the feedback is that it crashes on launch on all devices. The crash log attached shows this error;
Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method 'GalaSoft.MvvmLight.Messaging.Messenger:get_Default ()' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
The code that causes this error is in ViewWillAppear;
Messenger.Default.Register<LoggedInFailedMessage>(this, LoginFailed);
Messenger.Default.Register<LoggedInMessage>(this, LoggedIn);
The below stack overflow thread seems to indicate it might be caused by using value types, but I am using reference types.
System.ExecutionEngineException: Attempting to JIT compile method only in Debug Mode on device (MonoTouch)
Any ideas would be greatly appreciated! I don't know how I can test for these errors if they work when i debug on emulator and device but fail when apple test it.

Most of those issues where fixed a long time ago. Make sure your options for the AppStore builds (or the one you used to submit) match the one you're testing (e.g. Debug builds).
In particular make sure that the Enable generic value type sharing options is ON on the build you are submitting. This will include some extra code to ensure all value types code path variants are available at runtime.
Note that this setting should already be ON by default. Still it's a good practice to ensure your debugging/release settings are mostly (except debugging stuff) identical. Otherwise you risk testing different code, locally, than what you're submitting to the store.

Related

Buildfire: Debugging on IOS Test Flight

I can't seem to figure out why my plugin works fine on the Web App mode, versus the IOS Test Flight.
It seems like an angularjs dependency is not loading correctly, but I have no way of knowing.
Not sure what your app/plugin situation is precisely. However, a good place to start would be here https://github.com/BuildFire/sdk/wiki/App-Developer-Mode this will allow you to test your code live on the device without publishing. It hijacks the plugin and loads your localhost version so that you can test on the fly changes.
Also, you may want to try shipping logs with http://debug.buildfire.com this will allow you to read console logs remotely

Why does MathNet.Numerics.Control.UseManaged require Cuda?

I'm trying to test an ASP API controller which in turn calls out to a DLL which uses MathNet.Numerics.LinearAlgebra. I first call
MathNet.Numerics.Control.UseManaged();
However this call fails with the error
Exception thrown: 'System.NotSupportedException' in
MathNet.Numerics.dll
Additional information: Cuda Native Provider not found.
Why would Cuda be required when I'm explicitly telling MathNet to use managed not native?
It actually does not fail, the exception is handled internally. You can just continue debugging.
The exception is not actually thrown within the UseManaged call but internally at the static construction of the Control class, the first time it is being accessed and initializes the default providers (which includes probing whether any of the known native providers are available). Of course, Cuda is not required when using the managed providers.
This is indeed a small usability issue when debugging with "break on all exceptions" enabled. We may be able to avoid throwing the exception with a small refactoring. Maybe we should open a GitHub issue to track this?

Exception thrown in very specific configuration

I have very weird situation where I have unit test (XUnit) that try to resolve webapi controllers through Autofac ( with web api contrib).
I have a situation where If I switch my configuration in Release mode, test in x86 mode, and run my test (if debug my test then it works) it throws an exception about the fact it can't resolve the controller.
Change whatever parameters in the above configuration it then works perfectly(I am using VS2012).
I know it is very little information and can not ask for a solution, but any clue about what could have been wrong will be appreciated!
Just for the record , I was trying to look at the stack frame to extract the caller class of method. In release mode, JIT may actually optimize the call stack (kind of Tail optimization) and basically remove what I expected to find (and was able to find in debug).

Running sample projects in MvvmCross v3 (Hot Tuna)

I'm trying to run sample projects (viz. BestSellers and Conference) that are present in MvvmCross v3 branch. I resolved the strong assembly reference issues successfully. However each time I run a sample project, I get System.TypeLoadException in MvxFullBinding and MvxValueConverterRegistryFiller classes.
Exception in MvxFullBinding class:
Exception in MvxValueConverterRegistryFiller class:
Is anybody able to run the sample projects successfully? How do I get around these exceptions?
It looks like you're running this as the 'Touch' projects from Visual Studio? In which case you are way ahead of what I've managed to achieve.
If that is correct, then I suspect that what you are seeing is that you have:
built proper PCLs built in VS/Windows against the portable reference assemblies
but these cannot be executed against the current MonoTouch/Xamarin.iOS runtime.
If you try, you may see issues like: iOS black screen and MissingMethodException: Method not found: 'System.Type.op_Equality'
For some more info see 'almost portable binaries' on http://slodge.blogspot.co.uk/2013/01/almost-portable-binaries.html
There is 'proper' PCL support currently being worked on within XamLabs - so I am hopeful that there may be a solution to this problem arriving in the Xamarin.Android Alpha channel any day now - but don't expect this to be painless initially.
Of course, I might be wrong on this - this really is new territory and I will be fascinated to hear/read about your adventures. If you want to try to find more detail, then it may help to try looking deeper into the exception details, and looking into the console log trace on your mac.
For these two particular exceptions, I can confirm that both samples...
... although that is when I'm working on my Mac.

Java ME Application running fine in Emulator but crashing when deployed to N70. Any way to identify the reason for crashing?

I have developed a Java ME application for CLDC platform. It works fine when executed in an emulator. But when i deploy it to my N70 phone the application doesn't start at all in the phone. In my application there are some 14 classes and am creating an instance of each and putting them in the vector on application start. The classes just have one variable and 2 methods. Can this creating of lot of instances be the reason for its crashing?
Is there any way I can find out the reason why the application is not able to start in the phone?
Update:
Its running fine on emulator. And one more thing I would like to mention is that- The code stops executing only at the point where am creating those 14 instances and adding them to the vector. Till that point the code executes fine.
It might depend on where in the code you are creating those instances. If you are creating them in your MIDlet constructor or the startApp method try moving the initialization into the run method of your application.
One way of debugging J2ME applications that don't start on the phone is by adding "printf" style debug messages in your code to be written in the record store system and adding another MIDlet to your application to read from RMS and display those messages.
Or you could just comment bits of code and see if it works.
You can debug on device. If the emulator you are using is part of the Nokia SDK then there should be facilities elsewhere to carry out on-device testing and debugging. (I'd post more detail on this but I've only done this with Sony Ericsson phones recently.)
Another option is to use the Nokia tools that allow you to view the standard output and error for your application when it is running on your device (via Bluetooth for example).
The probability that your application is actually crashing the Java Virtual Machine bytecode interpreter thread and terminating the whole native process is very small.
It has happened before but you need to eliminate several other potential issues before being convinced of an actual crash.
It is more likely that either:
Your MIDlet is not created or not started because the MIDP runtime decides it is not correct.
or
Your MIDlet simply throws an exception that you don't catch, which can make it look like it was brutally terminated.
Since the MIDlet installer is supposed to prevent you from installing a bad MIDlet, the uncaught exception issue is more likely.
How to find an uncaught exception:
Start with the simplest HelloWorld MIDlet, using a Form so you can easily insert more StringItems at the top of the screen.
Create and start a new Thread in MIDlet.startApp()
In your override of Thread.run(), add a try{}catch(Throwable){} block.
Inside that block, do whatever your original MIDlet did.
Use the form as your standard output for debugging.
You can use Form logging to make sure you don't enter an infinite loop, to display exception classes and messages, to flag logical milestones, to display variable values...
That's the first step to figuring out what is going on.
I also faced a similar problem and when I recompiled my MIDLET as Midlet 1.0 then it worked fine. It seems like N70 is not able to run the new version of MIDLET. I think you downgrade and re-test your midlet.
Regards
Junaid

Resources