Bug 35375

Summary: Runtime crash in F# Interactive for F# 4.0
Product: [Mono] Runtime Reporter: Alex Corrado <alexc>
Component: ReflectionAssignee: Aleksey Kliger <aleksey>
Status: VERIFIED FIXED    
Severity: normal CC: aleksey, mono-bugs+mono, mono-bugs+runtime, peter.collins, shrutis
Priority: Normal    
Version: unspecified   
Target Milestone: C6SR4   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Alex Corrado 2015-10-29 16:25:51 UTC
Mono crashes when loading some F# into fsi. AFAICT the crash occurs in pretty much the entire Mono 4.x series.

Since we don't package F# 4.0 yet, I installed it from source:

1. Clone https://github.com/fsharp/fsharp
2. From the checkout, do the standard, ./configure && make
3. Install it into your system Mono: sudo make install


Once F# 4.0 is installed, you can reproduce the issue this way:

1. Open this in Xamarin Studio: https://github.com/chkn/SharpBoomerang/blob/master/docs/Introduction.fsx
2. Select all the #load lines near the top and press Ctrl+Return to run the lines in F# interactive
3. Observe the crash:

[Loading /Users/alex/Projects/SharpBoomerang/src/boomerang.fs]
* Assertion at metadata.c:1016, condition `idx < t->rows' not met
Stacktrace:
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.Emit.TypeBuilder.create_runtime_class (System.Reflection.Emit.TypeBuilder,System.Reflection.Emit.TypeBuilder) <0xffffffff>
  at System.Reflection.Emit.TypeBuilder.CreateTypeInfo () <0x00464>
  at System.Reflection.Emit.TypeBuilder.CreateType () <0x0001d>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.traverseTypeRef@1862 (System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, int>,System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, bool>,Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/emEnv,int,Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef) <0x00227>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.createTypeRef (System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, int>,System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, bool>,Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/emEnv,Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef) <0x0002f>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildTypeDefPass4 (System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, int>,System.Collections.Generic.Dictionary`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeRef, bool>,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeDef>,Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/emEnv,Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeDef) <0x00043>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/buildModuleFragment@1935-1.Invoke (Microsoft.FSharp.Compiler.AbstractIL.IL/ILTypeDef) <0x0003f>
  at Microsoft.FSharp.Primitives.Basics.List.iter<T_REF> (Microsoft.FSharp.Core.FSharpFunc`2<T_REF, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T_REF>) <0x00038>
  at Microsoft.FSharp.Collections.ListModule.Iterate<T_REF> (Microsoft.FSharp.Core.FSharpFunc`2<T_REF, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T_REF>) <0x00027>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildModuleFragment (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/cenv,Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/emEnv,System.Reflection.Emit.AssemblyBuilder,System.Reflection.Emit.ModuleBuilder,Microsoft.FSharp.Compiler.AbstractIL.IL/ILModuleDef) <0x00493>
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.emitModuleFragment (Microsoft.FSharp.Compiler.AbstractIL.IL/ILGlobals,Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter/emEnv,System.Reflection.Emit.AssemblyBuilder,System.Reflection.Emit.ModuleBuilder,Microsoft.FSharp.Compiler.AbstractIL.IL/ILModuleDef,bool,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Compiler.AbstractIL.IL/ILAssemblyRef, Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Core.FSharpChoice`2<string, System.Reflection.Assembly>>>) <0x0006b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.ProcessInputs (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/ParsedInput>,bool,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/Ident>) <0x0046b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedSourceFiles (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/ParsedInput>) <0x000af>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalSourceFiles (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Range/range,Microsoft.FSharp.Collections.FSharpList`1<string>,Microsoft.FSharp.Compiler.Lexhelp/LexResourceManager) <0x0039f>
  at Microsoft.FSharp.Compiler.Interactive.Shell/clo@1606-45.Invoke (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x000ef>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.InteractiveCatch<T_REF> (Microsoft.FSharp.Core.FSharpFunc`2<T_REF, System.Tuple`2<T_REF, Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionStepStatus>>,T_REF) <0x00039>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteraction (bool,Microsoft.FSharp.Compiler.CompileOps/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction) <0x00067>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteractions (bool,Microsoft.FSharp.Compiler.CompileOps/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction>) <0x0098f>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.MainThreadProcessParsedInteraction (bool,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction>,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x0012f>
  at Microsoft.FSharp.Compiler.Interactive.Shell/res@1819.Invoke (Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState) <0x00033>
  at Microsoft.FSharp.Compiler.Interactive.Shell/runCodeOnMainThread@2058-2<T_REF>.Invoke (Microsoft.FSharp.Core.Unit) <0x0003b>
  at <StartupCode$FSharp-Compiler-Interactive-Settings>.$Fsiaux/Microsoft-FSharp-Compiler-Interactive-IEventLoop-Invoke@47<T_REF>.Invoke (Microsoft.FSharp.Core.Unit) <0x0001a>
  at <StartupCode$FSharp-Compiler-Interactive-Settings>.$Fsiaux/run@38-4.Invoke (Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit, object>) <0x00039>
  at Microsoft.FSharp.Primitives.Basics.List.iter<T_REF> (Microsoft.FSharp.Core.FSharpFunc`2<T_REF, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T_REF>) <0x00038>
  at Microsoft.FSharp.Collections.ListModule.Iterate<T_REF> (Microsoft.FSharp.Core.FSharpFunc`2<T_REF, Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T_REF>) <0x00027>
  at <StartupCode$FSharp-Compiler-Interactive-Settings>.$Fsiaux.run@35 (Microsoft.FSharp.Compiler.Interactive.SimpleEventLoop,Microsoft.FSharp.Core.Unit) <0x000cb>
  at Microsoft.FSharp.Compiler.Interactive.SimpleEventLoop.Microsoft-FSharp-Compiler-Interactive-IEventLoop-Run () <0x0001f>
  at Microsoft.FSharp.Compiler.Interactive.Shell.runLoop@2103 (Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput,Microsoft.FSharp.Core.Unit) <0x00205>
  at Microsoft.FSharp.Compiler.Interactive.Shell.DriveFsiEventLoop (Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput) <0x0001b>
  at Microsoft.FSharp.Compiler.Interactive.Shell/FsiEvaluationSession.Run () <0x00bcb>
  at Microsoft.FSharp.Compiler.Interactive.Shell.evaluateSession@2420 (string[],Microsoft.FSharp.Core.Unit) <0x0009b>
  at Microsoft.FSharp.Compiler.Interactive.Shell.MainMain (string[]) <0x00127>
  at Microsoft.FSharp.Compiler.Interactive.Main.FsiMain (string[]) <0x00013>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
	0   mono                                0x001ae2c6 mono_handle_native_sigsegv + 342
	1   mono                                0x001fe8d1 sigabrt_signal_handler + 129
	2   libsystem_platform.dylib            0x93cc903b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x9713bdee abort + 156
	5   mono                                0x00352d11 monoeg_log_default_handler + 129
	6   mono                                0x00352e0b monoeg_assertion_message + 107
	7   mono                                0x00264170 mono_metadata_decode_row + 224
	8   mono                                0x002645ca mono_metadata_decode_table_row + 90
	9   mono                                0x0021316e find_method_in_metadata + 110
	10  mono                                0x0020c753 mono_class_init + 1155
	11  mono                                0x0020e3d6 setup_interface_offsets + 2662
	12  mono                                0x0020d95d mono_class_setup_interface_offsets + 29
	13  mono                                0x002e51e9 ensure_runtime_vtable + 537
	14  mono                                0x002e42d0 mono_reflection_create_runtime_class + 896
	15  ???                                 0x04820be0 0x0 + 75631584
	16  mscorlib.dll.dylib                  0x01a44035 System_Reflection_Emit_TypeBuilder_CreateTypeInfo + 1125
	17  mscorlib.dll.dylib                  0x01a43bbe System_Reflection_Emit_TypeBuilder_CreateType + 30
	18  ???                                 0x04f68c40 0x0 + 83266624
	19  ???                                 0x04f689f8 0x0 + 83266040
	20  ???                                 0x04f688f4 0x0 + 83265780
	21  ???                                 0x04f688a0 0x0 + 83265696
	22  ???                                 0x038ecac9 0x0 + 59689673
	23  ???                                 0x038eca80 0x0 + 59689600
	24  ???                                 0x04f50b74 0x0 + 83168116
	25  ???                                 0x04f504e4 0x0 + 83166436
	26  ???                                 0x048dc054 0x0 + 76398676
	27  ???                                 0x051458f0 0x0 + 85219568
	28  ???                                 0x05114240 0x0 + 85017152
	29  ???                                 0x051110f0 0x0 + 85004528
	30  ???                                 0x048cb7aa 0x0 + 76330922
	31  ???                                 0x05110770 0x0 + 85002096
	32  ???                                 0x05014360 0x0 + 83968864
	33  ???                                 0x05110200 0x0 + 85000704
	34  ???                                 0x051100bc 0x0 + 85000380
	35  ???                                 0x05110084 0x0 + 85000324
	36  ???                                 0x05110043 0x0 + 85000259
	37  ???                                 0x0510ff42 0x0 + 85000002
	38  ???                                 0x038ecac9 0x0 + 59689673
	39  ???                                 0x038eca80 0x0 + 59689600
	40  ???                                 0x04f5c004 0x0 + 83214340
	41  ???                                 0x04f5bf20 0x0 + 83214112
	42  ???                                 0x04f5bb0e 0x0 + 83213070
	43  ???                                 0x04f5b8f4 0x0 + 83212532
	44  ???                                 0x048cb364 0x0 + 76329828
	45  ???                                 0x005d36cc 0x0 + 6108876
	46  ???                                 0x005d3130 0x0 + 6107440
	47  ???                                 0x005d2edc 0x0 + 6106844
	48  ???                                 0x005d2fb4 0x0 + 6107060
	49  mono                                0x000fee9a mono_jit_runtime_invoke + 714
	50  mono                                0x002c354f mono_runtime_invoke + 127
	51  mono                                0x002c92a1 mono_runtime_exec_main + 401
	52  mono                                0x002c905a mono_runtime_run_main + 618
	53  mono                                0x0017718d mono_jit_exec + 93
	54  mono                                0x001794a0 mono_main + 7920
	55  mono                                0x000f1790 main + 768
	56  mono                                0x000f1485 start + 53
Debug info from gdb:
2015-10-29 16:15:44.574 xcodebuild[67427:4435893] [MT] DVTPlugInManager: Required plug-in compatibility UUID 7265231C-39B4-402C-89E1-16167C4CC990 for XSStoryboardExtensions.ideplugin (com.xamarin.XSStoryboardExtensions) not present
"monobt" command installed
(lldb) command source -s 0 '/tmp/mono-gdb-commands.qLS8G6'
Executing commands in '/tmp/mono-gdb-commands.qLS8G6'.
(lldb) process attach --pid 62497
warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 62497 stopped
* thread #1: tid = 0x3f097f, 0x9a495e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x9a495e16 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x9a495e16 <+10>: jae    0x9a495e26                ; <+26>
    0x9a495e18 <+12>: calll  0x9a495e1d                ; <+17>
    0x9a495e1d <+17>: popl   %edx
    0x9a495e1e <+18>: movl   0x6b7d207(%edx), %edx
Executable module set to "/Library/Frameworks/Mono.framework/Commands/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 62497 stopped
* thread #1: tid = 0x3f097f, 0x9a495e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x3f0984, 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
  thread #3: tid = 0x3f0985, 0x9a48fa0a libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #4: tid = 0x3f0986, 0x9a4968ce libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
  thread #5: tid = 0x3f09bc, 0x9a4958f6 libsystem_kernel.dylib`__semwait_signal + 10
  thread #6: tid = 0x3f09bd, 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
(lldb) thread backtrace all
* thread #1: tid = 0x3f097f, 0x9a495e16 libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x9a495e16 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x9715bb19 libsystem_c.dylib`waitpid$UNIX2003 + 48
    frame #2: 0x001ae38d mono`mono_handle_native_sigsegv(signal=6, ctx=0xbff101ec, info=0xbff101ac) + 541 at mini-exceptions.c:2193 [opt]
    frame #3: 0x001fe8d1 mono`sigabrt_signal_handler(_dummy=<unavailable>, _info=<unavailable>, context=<unavailable>) + 129 at mini-posix.c:208 [opt]
  thread #2: tid = 0x3f0984, 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x9b650163 libsystem_pthread.dylib`_pthread_cond_wait + 726
    frame #2: 0x9b653528 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x00321852 mono`thread_func(thread_data=0x00000000) + 466 at sgen-thread-pool.c:118 [opt]
    frame #4: 0x9b64fc25 libsystem_pthread.dylib`_pthread_body + 138
    frame #5: 0x9b64fb9b libsystem_pthread.dylib`_pthread_start + 162
    frame #6: 0x9b64ce32 libsystem_pthread.dylib`thread_start + 34
  thread #3: tid = 0x3f0985, 0x9a48fa0a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x9a48fa0a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0034434a mono`mono_sem_wait(sem=0x0042408c, alertable=1) + 26 at mono-semaphore.c:109 [opt]
    frame #2: 0x002c144e mono`finalizer_thread(unused=0x00000000) + 158 at gc.c:1096 [opt]
    frame #3: 0x0029b66c mono`start_wrapper [inlined] start_wrapper_internal + 463 at threads.c:723 [opt]
    frame #4: 0x0029b49d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:770 [opt]
    frame #5: 0x0034bee0 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:97 [opt]
    frame #6: 0x9b64fc25 libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9b64fb9b libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x9b64ce32 libsystem_pthread.dylib`thread_start + 34
  thread #4: tid = 0x3f0986, 0x9a4968ce libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x9a4968ce libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x9b90573f libdispatch.dylib`_dispatch_mgr_invoke + 245
    frame #2: 0x9b9053a2 libdispatch.dylib`_dispatch_mgr_thread + 52
  thread #5: tid = 0x3f09bc, 0x9a4958f6 libsystem_kernel.dylib`__semwait_signal + 10
    frame #0: 0x9a4958f6 libsystem_kernel.dylib`__semwait_signal + 10
    frame #1: 0x9715bc0a libsystem_c.dylib`nanosleep$UNIX2003 + 218
    frame #2: 0x00338967 mono`wapi_SleepEx(ms=<unavailable>, alertable=1) + 199 at wthreads.c:289 [opt]
    frame #3: 0x00296a1e mono`ves_icall_System_Threading_Thread_Sleep_internal(ms=200) + 94 at threads.c:1198 [opt]
    frame #4: 0x04f5a234
    frame #5: 0x0194ac44 mscorlib.dll.dylib`System_Threading_Thread_Sleep_int + 36
    frame #6: 0x04f59d48
    frame #7: 0x0194a09f mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart_Context_object + 143
    frame #8: 0x01948885 mscorlib.dll.dylib`System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 421
    frame #9: 0x019486d4 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 52
    frame #10: 0x0194864b mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 91
    frame #11: 0x0194a1ca mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart + 58
    frame #12: 0x005d83ed
    frame #13: 0x000fee9a mono`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 714 at mini-runtime.c:2334 [opt]
    frame #14: 0x002c354f mono`mono_runtime_invoke(method=0x7a3d9bb0, obj=0x0092e120, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2783 [opt]
    frame #15: 0x002c8a4c mono`mono_runtime_delegate_invoke(delegate=0x0092e120, params=<unavailable>, exc=<unavailable>) + 92 at object.c:3494 [opt]
    frame #16: 0x0029b6e5 mono`start_wrapper [inlined] start_wrapper_internal + 584 at threads.c:729 [opt]
    frame #17: 0x0029b49d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:770 [opt]
    frame #18: 0x0034bee0 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:97 [opt]
    frame #19: 0x9b64fc25 libsystem_pthread.dylib`_pthread_body + 138
    frame #20: 0x9b64fb9b libsystem_pthread.dylib`_pthread_start + 162
    frame #21: 0x9b64ce32 libsystem_pthread.dylib`thread_start + 34
  thread #6: tid = 0x3f09bd, 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x9a495512 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x9b650163 libsystem_pthread.dylib`_pthread_cond_wait + 726
    frame #2: 0x9b653528 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x00327245 mono`_wapi_handle_timedwait_signal_handle(handle=<unavailable>, timeout=<unavailable>, alertable=<unavailable>, poll=<unavailable>) + 485 at handles.c:1609 [opt]
    frame #4: 0x003272f8 mono`_wapi_handle_wait_signal_handle(handle=0x00000d0a, alertable=1) + 40 at handles.c:1554 [opt]
    frame #5: 0x00336d4d mono`wapi_WaitForSingleObjectEx(handle=<unavailable>, timeout=<unavailable>, alertable=2025366324) + 493 at wait.c:194 [opt]
    frame #6: 0x00337507 mono`wapi_WaitForMultipleObjectsEx(numobjects=<unavailable>, handles=<unavailable>, waitall=2067363488, timeout=<unavailable>, alertable=1) + 103 at wait.c:516 [opt]
    frame #7: 0x00297333 mono`ves_icall_System_Threading_WaitHandle_WaitAll_internal [inlined] mono_wait_uninterrupted(alertable=1) + 56 at threads.c:1445 [opt]
    frame #8: 0x002972fb mono`ves_icall_System_Threading_WaitHandle_WaitAll_internal(mono_handles=<unavailable>, ms=-1, exitContext=0) + 171 at threads.c:1500 [opt]
    frame #9: 0x04f5cbe0
    frame #10: 0x01b095d1 mscorlib.dll.dylib`System_Threading_WaitHandle_WaitAll_System_Threading_WaitHandle__ + 65
    frame #11: 0x0510ff00
    frame #12: 0x0510fd88
    frame #13: 0x0510fac4
    frame #14: 0x00723be5
    frame #15: 0x04f5d2c9
    frame #16: 0x048cb7aa
    frame #17: 0x04f5cfe0
    frame #18: 0x04f5c5fc
    frame #19: 0x0194a09f mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart_Context_object + 143
    frame #20: 0x01948885 mscorlib.dll.dylib`System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 421
    frame #21: 0x019486d4 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 52
    frame #22: 0x0194864b mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 91
    frame #23: 0x0194a1ca mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart + 58
    frame #24: 0x005d83ed
    frame #25: 0x000fee9a mono`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 714 at mini-runtime.c:2334 [opt]
    frame #26: 0x002c354f mono`mono_runtime_invoke(method=0x7a3d9bb0, obj=0x0092e698, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2783 [opt]
    frame #27: 0x002c8a4c mono`mono_runtime_delegate_invoke(delegate=0x0092e698, params=<unavailable>, exc=<unavailable>) + 92 at object.c:3494 [opt]
    frame #28: 0x0029b6e5 mono`start_wrapper [inlined] start_wrapper_internal + 584 at threads.c:729 [opt]
    frame #29: 0x0029b49d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:770 [opt]
    frame #30: 0x0034bee0 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:97 [opt]
    frame #31: 0x9b64fc25 libsystem_pthread.dylib`_pthread_body + 138
    frame #32: 0x9b64fb9b libsystem_pthread.dylib`_pthread_start + 162
    frame #33: 0x9b64ce32 libsystem_pthread.dylib`thread_start + 34
(lldb) detach
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
(lldb) quit
Process 62497 detached

$ mono --version

Mono JIT compiler version 4.2.1 (explicit/b50293b Wed Oct 14 13:34:15 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       altstack
        Notification:  kqueue
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug 
        LLVM:          yes(3.6.0svn-mono-(detached/a173357)
        GC:            sgen
Comment 1 Aleksey Kliger 2015-11-02 11:28:27 UTC
Minimal repro: Paste the following into an fsharpi session.

----snip----

type I<'t> =
  abstract W : 't -> unit

;;  

type S () =
    interface I<char> with
        member __.W (v : char) = ()

;;


----snip----
Comment 2 Aleksey Kliger 2015-11-03 15:13:13 UTC
The code in mono_class_init() goes looking for a .cctor in the metadata tables of the image associated with the class to be initialized (even though in this case it's an interface).  But we have a dynamic image and it doesn't have tables, so we assert.

The fix is easy (check that the class we're initializing is not in a dynamic image). (There's also a question of why we're looking for a .cctor in an interface in the first place.  But I bet we can get into a similar situation with abstract classes too.)

The difficult part is writing a test case that mirrors what F# interactive is doing.
Comment 5 Shruti 2016-04-18 12:51:32 UTC
@Alex Corrado, @Aleksey Kliger I have checked this issue on latest builds and it is working fine. Here is the screencast: http://www.screencast.com/t/QJq0ftuT6

Before verifying this issue, it must be reproduced at my end. Can you please let me know in which build you able to face this issue. It will help me lot to verify this issue.

Thanks!!
Looking for your reply!!
Comment 6 Alex Corrado 2016-04-19 16:27:11 UTC
@Shruti See the end of the original post:


$ mono --version

Mono JIT compiler version 4.2.1 (explicit/b50293b Wed Oct 14 13:34:15 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       altstack
        Notification:  kqueue
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug 
        LLVM:          yes(3.6.0svn-mono-(detached/a173357)
        GC:            sgen

Hope this helps!
Comment 7 Shruti 2016-05-05 10:01:41 UTC
***********************************
Reproduce Status (Not Reproducible)
***********************************
I have followed the steps as given in Comment(0) to reproduce this issue, but not getting this issue. Please see below the steps I followed to reproduce the issue

1. I have Installed Mono 4.2.1.60, it installs F#3.1 itself
2. Install F# 4.0 by following github link mentioned in comment(0)
   >> 1. Clone https://github.com/fsharp/fsharp
   >> 2. From the checkout, do the standard, ./configure && make
   >> 3. Install it into your system Mono: sudo make install
3. Downnload https://github.com/chkn/SharpBoomerang/blob/master/docs/Introduction.fsx and Open this in Xamarin Studio.
4. Select all the #load lines near the top and press Ctrl+Return to run the lines in F# interactive

Actual Result: I did not get any error. It is working fine.
Screencast: http://www.screencast.com/t/jFPnbhFHv0Z
Environment Info: https://gist.github.com/shrutis360/8364bc80e56edb7444ab431ba8afcbf8

***********************************
Verify Status (Working fine)
***********************************

I have installed C6SR4 Mono 4.2.4.2, followed steps 3 & 4 and observed that it is working fine.

Screencast:  http://www.screencast.com/t/jVpbONDG1k1m
Environment Info: https://gist.github.com/shrutis360/b55ae6b25463e9e81d84a59ab5fb3011

@Alex: Please let me know If I missed anything to reproduce this issue.
Comment 8 Aleksey Kliger 2016-05-09 14:39:11 UTC
Shruti,

SharpBoomerang was rewritten at some point so the master branch of Introduction.fsx doesn't correspond to the version in the Description.

Try the minimal reproduction from Comment 1, that example is self contained.

(In reply to Shruti from comment #7)
> I have followed the steps as given in Comment(0) to reproduce this issue,
> but not getting this issue. Please see below the steps I followed to
> reproduce the issue
>
[snip]
>
> Screencast:  http://www.screencast.com/t/jVpbONDG1k1m
> Environment Info:
> https://gist.github.com/shrutis360/b55ae6b25463e9e81d84a59ab5fb3011
> 
> @Alex: Please let me know If I missed anything to reproduce this issue.
Comment 9 Shruti 2016-05-10 07:25:46 UTC
Thanks Aleksey, it works for me. Please find below the status:

***************************************
Reproduce Status:
***************************************
I have pasted code given in comment(1) in fsharp interactive session with current stable builds and got crash in fsharp interactive session.

Screencast: http://www.screencast.com/t/qUaytm5D
Fsharp Interactive output:  https://gist.github.com/shrutis360/24c68855568391a4aa841b225c15b7c6
Environment Info:  https://gist.github.com/shrutis360/1b8189e03a92045022f3a7bd90db14b5

***************************************
Verify Status:
***************************************

Not get Runtime crash in F# Interactive with Mono 4.2.4.4.

Screencast: http://www.screencast.com/t/1pUPfDpPcj
Fsharp Interactive output:  https://gist.github.com/shrutis360/d191f5a85426e6e6e659c7dba975bb33
Environment Info: https://gist.github.com/shrutis360/fa29572163c056461c23cfc99854c26f