xamarin / urho-samples

Samples for the Urho bindings
MIT License
384 stars 491 forks source link

Multiple Page Visits Crashes XAP #10

Closed v534 closed 8 years ago

v534 commented 8 years ago

Visiting different pages each with an UrhoSurface seems to cause a crash after a few times.

For example if you replace "restartBtn.Clicked += (sender, e) => StartUrhoApp();" in App.cs with "restartBtn.Clicked += (sender, e) => Navigation.PushAsync(new UrhoPage());". After clicking a few times on "Restart", there is a crash with the error below. This also happens if you go back and then return to the page again.

Java.Lang.NullPointerException: at --- End of managed exception stack trace --- at java.lang.NullPointerException at at org.libsdl.app.SDLActivity.handleNativeExit(SDLActivity.java:170) at at org.libsdl.app.SDLSurface$1.run(SDLSurface.java:164) at at java.lang.Thread.run(Thread.java:841)

v534 commented 8 years ago

I also tried running on a real android device and it crashes in the same situation. I also tried building in release mode and got the error below. If I remove the Urho package from the Android project the error goes away but then it fails when you run the Urho page.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Error executing task LinkAssemblies: error XA2006: Reference to metadata item '!!0[] System.Array::Empty()' (defined in 'Urho.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Urho.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. (FormsSample.Droid)

MichalPetryk commented 8 years ago

I have the same problem... I can't build FormsSample.Droid project in release mode. I got the error:

Severity Code Description Project File Line Suppression State Error The "LinkAssemblies" task failed unexpectedly. Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item '!!0[] System.Array::Empty()' (defined in 'Urho.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Urho.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve !!0[] System.Array::Empty() at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.Process() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute() --- End of inner exception stack trace --- at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() FormsSample.Droid

Can anyone help me to resolve this issue?

v534 commented 8 years ago

I tried the latest commits again and also still get this compile issue.

I also still get the crash issue when I replace "restartBtn.Clicked += (sender, e) => StartUrhoApp();" in App.cs with "restartBtn.Clicked += (sender, e) => Navigation.PushAsync(new UrhoPage());", and then click a few times on "Restart". Navigating back and forward several times also also crashes, although it seems less easily reproducible now.

EgorBo commented 8 years ago

@v534 we are working on this issue

v534 commented 8 years ago

@EgorBo thanks for your great work on urho-samples! Any ETA on these 2 issues? It's blocking me from moving forward.

v534 commented 8 years ago

I have the same 2 issues even after the latest update.

EgorBo commented 8 years ago

@v534 fixed in master, will be available with the next nuget update

v534 commented 8 years ago

I downloaded the latest FormSample files again and updated to the latest UrhoSharp.Forms 1.0.557 and Xamarin.Forms 2.2.0.43, but still have the same issues. Do I need to wait for something further?

ISSUES:

  1. Building in release mode fails.
  2. Pressing the back button does not return to the previous page and instead freezes the animation.
  3. Clicking the restart button after updating it to "restartBtn.Clicked += (sender, e) => Navigation.PushAsync(new UrhoPage());" causes the animation to freeze and eventually the following crash:

System.ArgumentException: 'jobject' must not be IntPtr.Zero. Parameter name: jobject at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod) [0x00010] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:170 at Android.Views.View.get_Context () [0x0002d] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:4891 at Urho.Forms.AndroidUrhoSurface+d5.MoveNext () [0x000ad] in :0 at --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142 at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372 at Urho.Forms.UrhoSurface+d41[TUrhoApplication].MoveNext () [0x0008d] in <filename unknown>:0 at --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372 at FormsSample.UrhoPage+casync1.MoveNext () [0x00086] in /urho-samples-master/FormsSample/FormsSample/App.cs:84 at --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.AsyncMethodBuilderCore.m0 (System.Object state) [0x00000] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:994 at Android.App.SyncContext+cAnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:18 at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36 at Java.Lang.IRunnableInvoker.n_Run (IntPtr jnienv, IntPtr nativethis) [0x00009] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:71 at at (wrapper dynamic-method) System.Object:baaf141f-1e29-4543-8d4e-0fd5bbe9d9be (intptr,intptr)