Harden against crash when generating stack trace.
Harden against crash when generating stack trace.

In some cases, I'm seeing IKVM and MonoTouch's AOT compiler get into a shouting
match when trying to generate a stack trace. This ends up looking like:

<Warning>: Unhandled managed exception: Default constructor not found for type IKVM.NativeCode.sun.reflect.State (System.MissingMethodException)
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance[State] () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.ConditionalWeakTable`2[System.Reflection.MethodBase,IKVM.NativeCode.sun.reflect.State].<GetOrCreateValue>m__1C (System.Reflection.MethodBase k) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.ConditionalWeakTable`2[System.Reflection.MethodBase,IKVM.NativeCode.sun.reflect.State].GetValue (System.Reflection.MethodBase key, System.Runtime.CompilerServices.CreateValueCallback createValueCallback) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.ConditionalWeakTable`2[System.Reflection.MethodBase,IKVM.NativeCode.sun.reflect.State].GetOrCreateValue (System.Reflection.MethodBase key) [0x00000] in <filename unknown>:0
at IKVM.NativeCode.sun.reflect.Reflection.IsHideFromJava (System.Reflection.MethodBase mb) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper.IsHideFromJava (System.Reflection.MethodBase mb) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper+ExceptionInfoHelper.Append (System.Collections.Generic.List`1 stackTrace, System.Diagnostics.StackTrace st, Int32 skip, Boolean isLast) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper+ExceptionInfoHelper.get_StackTrace (System.Exception t) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper.getStackTrace (System.Exception x) [0x00000] in <filename unknown>:0
at java.lang.Throwable.instancehelper_getStackTrace (System.Exception this) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper.BuildStackTrace (System.Exception x) [0x00000] in <filename unknown>:0
at IKVM.Internal.ExceptionHelper.printStackTrace (System.Exception x, java.io.PrintWriter printWriter) [0x00000] in <filename unknown>:0
at java.lang.Throwable.instancehelper_printStackTrace (System.Exception this, java.io.PrintWriter s) [0x00000] in <filename unknown>:0
...

which is an unhandled exception, and the app then crashes.

I'll try to fix the root cause, but I don't want any future disagreements to
result in unexpected crashery.

longtaoge/playn,playn/playn,rachelharvey/playn,ruslansennov/playn2,tinkerstudent/playn,playn/playn,playn/playn,tinkerstudent/playn,ruslansennov/playn2,thecocce/playn-1,longtaoge/playn,thecocce/playn-1,rachelharvey/playn