You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
System.InvalidCastException: 'Specified cast is not valid.' 10-24 12:10:15.331 I/MonoDroid(22572): UNHANDLED EXCEPTION: 10-24 12:10:15.339 I/MonoDroid(22572): System.InvalidCastException: Specified cast is not valid. 10-24 12:10:15.340 I/MonoDroid(22572): at Urho.Forms.AndroidUrhoSurface.Launcher (System.Type type, Urho.ApplicationOptions options) [0x0008f] in <4f2ed849f9044063a00907b1dcc872ae>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Urho.Forms.UrhoSurface.Show[TUrhoApplication] (Urho.ApplicationOptions options) [0x000e9] in <4f2ed849f9044063a00907b1dcc872ae>:0 10-24 12:10:15.340 I/MonoDroid(22572): at FormsSample.Views.MainView.OnAppearing () [0x00033] in D:\repos\3D\test-projects\FormsSample\FormsSample\FormsSample\Views\MainView.xaml.cs:33 10-24 12:10:15.340 I/MonoDroid(22572): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <6de48997d0c0445dbea8d4d83492d8c6>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.31(intptr,intptr)
This error only happens when you use UrhoSharp inside a Xamarin.Forms Android app which uses MvvmCross. My guess is that in the Launcher method from AndroidUrhoSurface it gets an instance of MvxFormsAppCompatActivity instead of a FormsAppCompatActivity instance. Can I solve this somehow? I already tried deleting bin/obj folders, restarting Visual Studio, Windows, etc.
I have attached a sample that can reproduce the issue. FormsSample.zip
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When I call
await urhoSurface.Show<UrhoApp>(new ApplicationOptions(assetsFolder: null) { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });
I get this error:
System.InvalidCastException: 'Specified cast is not valid.' 10-24 12:10:15.331 I/MonoDroid(22572): UNHANDLED EXCEPTION: 10-24 12:10:15.339 I/MonoDroid(22572): System.InvalidCastException: Specified cast is not valid. 10-24 12:10:15.340 I/MonoDroid(22572): at Urho.Forms.AndroidUrhoSurface.Launcher (System.Type type, Urho.ApplicationOptions options) [0x0008f] in <4f2ed849f9044063a00907b1dcc872ae>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Urho.Forms.UrhoSurface.Show[TUrhoApplication] (Urho.ApplicationOptions options) [0x000e9] in <4f2ed849f9044063a00907b1dcc872ae>:0 10-24 12:10:15.340 I/MonoDroid(22572): at FormsSample.Views.MainView.OnAppearing () [0x00033] in D:\repos\3D\test-projects\FormsSample\FormsSample\FormsSample\Views\MainView.xaml.cs:33 10-24 12:10:15.340 I/MonoDroid(22572): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <6de48997d0c0445dbea8d4d83492d8c6>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11a340ccc8de43f09c97400139266ef5>:0 10-24 12:10:15.340 I/MonoDroid(22572): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.31(intptr,intptr)
This error only happens when you use UrhoSharp inside a Xamarin.Forms Android app which uses MvvmCross. My guess is that in the Launcher method from AndroidUrhoSurface it gets an instance of MvxFormsAppCompatActivity instead of a FormsAppCompatActivity instance. Can I solve this somehow? I already tried deleting bin/obj folders, restarting Visual Studio, Windows, etc.
I have attached a sample that can reproduce the issue.
FormsSample.zip
The text was updated successfully, but these errors were encountered: