Version Number of Plugin: 4.0.0.5
Device Tested On: iPhone 6Plus
Simulator Tested On: Version 10.0
Version of VS: Visual Studio for Mac 7.5 (build 1254)
Version of Xamarin: Xamarin.Forms package version 2.5.0.122203
Xamarin.iOS
Version: 11.10.1.177 (Visual Studio Professional)
Steps to reproduce the Behavior
Added call to CrossDeviceInfo.Current.Platform in code.
Expected Behavior
No crash
Actual Behavior
Method containing this call cannot be executed on device (Works fine within simulator).
Fails with:
Bug Information
Version Number of Plugin: 4.0.0.5 Device Tested On: iPhone 6Plus Simulator Tested On: Version 10.0 Version of VS: Visual Studio for Mac 7.5 (build 1254) Version of Xamarin: Xamarin.Forms package version 2.5.0.122203 Xamarin.iOS Version: 11.10.1.177 (Visual Studio Professional)
Steps to reproduce the Behavior
Added call to CrossDeviceInfo.Current.Platform in code.
Expected Behavior
No crash
Actual Behavior
Method containing this call cannot be executed on device (Works fine within simulator). Fails with:
System.ExecutionEngineException has been thrown Attempting to JIT compile method 'Acc.C.ThemeManager:SetCurrentTheme (string)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.
Code snippet
public void SetCurrentTheme(String aTheme) { ... if(CrossDeviceInfo.Current.Platform == Platform.iOS) Application.Current.Resources.Add("AISeparatorVisibility", SeparatorVisibility.None); else Application.Current.Resources.Add("AISeparatorVisibility", SeparatorVisibility.Default); }
After removing this block of code, everything else works as expected.
Stacktrace at: https://gist.github.com/kiwicodemonkey/9038bd117b313fb508ec0a2a2c67cde1
This error happens with any call to any CrossDeviceInfo method.