Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

ANR when running tests on Android #96

Open
mfkl opened this issue May 12, 2017 · 1 comment
Open

ANR when running tests on Android #96

mfkl opened this issue May 12, 2017 · 1 comment
Labels

Comments

@mfkl
Copy link

mfkl commented May 12, 2017

Hi!

Thank you for your work on NUnit.

I encounter an issue when running the tests with (I suspect)TerminateAfterExecution = true.
The tests run fine, breakpoints get hit. But once that's done, the UI freezes for a bit and then the app crashes.

using:
nunit.Options = new TestOptions { AutoRun = true, TerminateAfterExecution = true };

[mono] Unhandled Exception: [mono] System.ObjectDisposedException: Cannot access a disposed object. [mono] Object name: 'The ThreadLocal object has been disposed.'. [mono] at System.Threading.ThreadLocal1[T].GetValueSlow () [0x00014] in <08c2fe83337b4f23b8377cd91091fe75>:0

[mono] at System.Threading.ThreadLocal1[T].get_Value () [0x0003e] in <08c2fe83337b4f23b8377cd91091fe75>:0 `

[mono] at Java.Interop.JniEnvironment.get_CurrentInfo () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono] at Java.Interop.JniEnvironment.get_Runtime () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono] at Java.Interop.JniObjectReference.Dispose (Java.Interop.JniObjectReference& reference) [0x00026] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono] at Java.Interop.JniRuntime.Dispose (System.Boolean disposing) [0x00033] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono] at Java.Interop.JniRuntime.Finalize () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.

[mono-rt] Object name: 'The ThreadLocal object has been disposed.'. [mono-rt] at System.Threading.ThreadLocal1[T].GetValueSlow () [0x00014] in <08c2fe83337b4f23b8377cd91091fe75>:0

[mono-rt] at System.Threading.ThreadLocal1[T].get_Value () [0x0003e] in <08c2fe83337b4f23b8377cd91091fe75>:0

[mono-rt] at Java.Interop.JniEnvironment.get_CurrentInfo () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono-rt] at Java.Interop.JniEnvironment.get_Runtime () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono-rt] at Java.Interop.JniObjectReference.Dispose (Java.Interop.JniObjectReference& reference) [0x00026] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono-rt] at Java.Interop.JniRuntime.Dispose (System.Boolean disposing) [0x00033] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

[mono-rt] at Java.Interop.JniRuntime.Finalize () [0x00000] in <8f50e0a9c86d4dfb89aa44f9276b9b1c>:0

Setting AutoRun to false leads to the same problem after running the tests manually. However, if I start the app again after a crash without uninstalling it, I'll get different exceptions on various components (JNI, Forms). Not sure that's helpful or relevant to solve the 1st problem, posting the stacktrace anyway.

[mono] Unhandled Exception:
[mono] System.NullReferenceException: Object reference not set to an instance of an object.
[mono] at Java.Interop.JniEnvironmentInfo..ctor () [0x00018] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at Java.Interop.JniEnvironment+<>c.<.cctor>b__35_0 () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at System.Threading.ThreadLocal1[T].GetValueSlow () [0x00031] in <d18287e1d683419a8ec3216fd78947b9>:0 [mono] at System.Threading.ThreadLocal1[T].get_Value () [0x0003e] in :0
[mono] at Java.Interop.JniEnvironment.get_CurrentInfo () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at Java.Interop.JniEnvironment.get_Runtime () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at Java.Interop.JniObjectReference.Dispose (Java.Interop.JniObjectReference& reference) [0x00026] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at Java.Interop.JniRuntime.Dispose (System.Boolean disposing) [0x00033] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono] at Java.Interop.JniRuntime.Finalize () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
[mono-rt] at Java.Interop.JniEnvironmentInfo..ctor () [0x00018] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at Java.Interop.JniEnvironment+<>c.<.cctor>b__35_0 () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at System.Threading.ThreadLocal1[T].GetValueSlow () [0x00031] in <d18287e1d683419a8ec3216fd78947b9>:0 [mono-rt] at System.Threading.ThreadLocal1[T].get_Value () [0x0003e] in :0
[mono-rt] at Java.Interop.JniEnvironment.get_CurrentInfo () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at Java.Interop.JniEnvironment.get_Runtime () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at Java.Interop.JniObjectReference.Dispose (Java.Interop.JniObjectReference& reference) [0x00026] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at Java.Interop.JniRuntime.Dispose (System.Boolean disposing) [0x00033] in <5716a943049b49ca928a3a1c8d2386f4>:0
[mono-rt] at Java.Interop.JniRuntime.Finalize () [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0

Config:

  • NUnit 3.6.1
  • nunit.xamarin 3.6.1
  • PCLStorage 1.0.2
  • Xamarin.Forms 2.3.3.193
  • Tested on both sim and device

Hope this helps. Let me know if you need more info.

@rprouse
Copy link
Member

rprouse commented May 18, 2017

Thanks for the detailed report. We will look into it when we get a chance.

@rprouse rprouse added the is:bug label May 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants