Bug 31244 - Assertion: at loader.c:297 trying to get signature of CoreCLR System.Collections.ObjectModel.ReadOnlyCollection`1<class System.Exception>::.ctor(class System.Collections.Generic.IList`1<!0>)
Summary: Assertion: at loader.c:297 trying to get signature of CoreCLR System.Collecti...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-19 09:28 UTC by Marcin Cieślak
Modified: 2017-08-28 15:05 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
mscorlib.dll (2.18 MB, application/x-msdownload)
2015-06-19 09:28 UTC, Marcin Cieślak
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Marcin Cieślak 2015-06-19 09:28:43 UTC
Created attachment 11680 [details]
mscorlib.dll

Running mono git master () of FreeBSD/amd64: 
b044a27fe0006830b2793e3d34f45407b656b8b2 plus patch for https://bugzilla.xamarin.com/show_bug.cgi?id=29679

An attempt to disassemble mscorlib.dll from CoreCLR fails with:

.namespace System
{
  .class public auto ansi beforefieldinit AggregateException
        extends System.Exception
  {
    .custom instance void class System.Diagnostics.DebuggerDisplayAttribute::'.ctor'(string) =  (
                01 00 1D 43 6F 75 6E 74 20 3D 20 7B 49 6E 6E 65   // ...Count = {Inne
                72 45 78 63 65 70 74 69 6F 6E 43 6F 75 6E 74 7D   // rExceptionCount}
                00 00                                           ) // ..

    .field  private  class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.Exception> m_inner
Exceptions

    // method line 84
    .method public hidebysig specialname rtspecialname 
           instance default void '.ctor' ()  cil managed 
    {
        // Method begins at RVA 0x22dc
        // Code size 34 (0x22)
        .maxstack 8
        IL_0000:  ldarg.0 
        IL_0001:  ldstr "AggregateException_ctor_DefaultMessage"
        IL_0006:  call string class System.Environment::GetResourceString(string)
        IL_000b:  call instance void class System.Exception::'.ctor'(string)
        IL_0010:  ldarg.0 
        IL_0011:  ldc.i4.0 
        IL_0012:  newarr System.Exception
        IL_0017:  newobj Unhandled loader error: 7, (null) /home/saper/git/precompiled/Product/FreeBSD.x64.Deb
ug/mscorlib.dll ReadOnlyCollection`1
* Assertion: should not be reached at loader.c:297

[New Thread 801c06400 (LWP 100845/monodis)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 801c06400 (LWP 100845/monodis)]
0x00000008014d6caa in thr_kill () from /lib/libc.so.7

backtrace:

#0  0x00000008014d6caa in thr_kill () from /lib/libc.so.7
#1  0x00000008014d6c16 in raise () from /lib/libc.so.7
#2  0x00000008014d5409 in abort () from /lib/libc.so.7
#3  0x000000000054abaa in monoeg_log_default_handler (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, 
    message=0x801c1ebc0 "* Assertion: should not be reached at loader.c:297\n", unused_data=0x0)
    at goutput.c:233
#4  0x000000000054aab2 in monoeg_g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, 
    format=0x55b27f "* Assertion: should not be reached at %s:%d\n", args=0x7fffffffd320) at goutput.c:113
#5  0x000000000054ae78 in monoeg_assertion_message (
    format=0x55b27f "* Assertion: should not be reached at %s:%d\n") at goutput.c:133
#6  0x0000000000446dec in mono_loader_assert_no_error () at loader.c:297
#7  0x000000000041b45b in mono_class_create_from_typedef (image=<value optimized out>, 
    type_token=<value optimized out>, error=<value optimized out>) at class.c:5943
#8  0x0000000000429095 in mono_class_get_checked (image=<value optimized out>, 
    type_token=<value optimized out>, error=<value optimized out>) at class.c:7360
#9  0x000000000042931d in mono_class_get (image=0x189ed, type_token=6) at class.c:7309
#10 0x000000000040df5f in get_type (m=0x801c92600, 
    ptr=0x8035c1385 "\001\022\201\004\n \001\001\025\022\211$\001\023", result=0x7fffffffd608, 
    is_def=<value optimized out>, container=<value optimized out>) at get.c:1284
#11 0x000000000040dfa9 in get_type (m=0x801c92600, 
    ptr=0x8035c1382 "\022\210¬\001\022\201\004\n \001\001\025\022\211$\001\023", result=0x7fffffffd760, 
    is_def=0, container=0x0) at get.c:1304
#12 0x000000000040dc57 in get_typespec (m=0x801c92600, idx=152, is_def=0, container=0x0) at get.c:251
#13 0x0000000000410d2f in get_method_core (m=0x801c92600, token=167772213, fullsig=1, 
    container=<value optimized out>) at get.c:1938
#14 0x0000000000414e09 in disassemble_cil (m=0x801c92600, mh=<value optimized out>, container=0x0)
    at dis-cil.c:156
#15 0x000000000040ca72 in dis_method_list (klass_name=0x80358402b "AggregateException", m=0x801c92600, 
    start=<value optimized out>, end=<value optimized out>, type_container=0x0) at main.c:694
#16 0x000000000040b1de in dis_type (m=0x801c92600, n=12, is_nested=0, forward=0) at main.c:1251
#17 0x000000000040aa8f in dis_types (m=0x801c92600, forward=0) at main.c:1477
#18 0x000000000040a72e in disassemble_file (file=<value optimized out>) at main.c:1635
#19 0x0000000000409648 in main (argc=<value optimized out>, argv=<value optimized out>) at main.c:2009


(gdb) frame 10
#10 0x000000000040df5f in get_type (m=0x801c92600, 
    ptr=0x8035c1385 "\001\022\201\004\n \001\001\025\022\211$\001\023", result=0x7fffffffd608, 
    is_def=<value optimized out>, container=<value optimized out>) at get.c:1284
1284                    MonoClass *klass = mono_class_get (m, token);
Current language:  auto; currently minimal
(gdb) print/x token
$1 = 0x200022b

Unfortunately, when trying to disassemble just one class taken out of mscorlib (AggregateException)
the exception does not occur (maybe because ReadOnlyCollection is imported from the assembly)

ikdasm produces the following output:

.class public auto ansi beforefieldinit System.AggregateException
       extends System.Exception
{
  .custom instance void System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 1D 43 6F 75 6E 74 20 3D 20 7B 49 6E 6E 65   // ...Count = {Inne
                                                                                       72 45 78 63 65 70 74 69 6F 6E 43 6F 75 6E 74 7D   // rExceptionCount}
                                                                                       00 00 )
  .field private class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.Exception> m_innerExceptions
  .method public hidebysig specialname rtspecialname
          instance void  .ctor() cil managed
  {
    // Code size       34 (0x22)
    .maxstack  8
    IL_0000:  ldarg.0
    IL_0001:  ldstr      "AggregateException_ctor_DefaultMessage"
    IL_0006:  call       string System.Environment::GetResourceString(string)
    IL_000b:  call       instance void System.Exception::.ctor(string)
    IL_0010:  ldarg.0
    IL_0011:  ldc.i4.0
    IL_0012:  newarr     System.Exception
    IL_0017:  newobj     instance void class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.Exception>::.ctor(class System.Collections.Generic.IList`1<!0>)
    IL_001c:  stfld      class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.Exception> System.AggregateException::m_innerExceptions
    IL_0021:  ret
  } // end of method AggregateException::.ctor
Comment 1 Marcin Cieślak 2015-06-22 15:48:24 UTC
Another interesting way to reproduce:

> monodis --methodspec rep/mscorlib.dll

MethodSpec (1..278)
1: int32 class System.Array::BinarySearch<!!0> (!!0[], int32, int32, !!0, class System.Collections.Generic.IComparer`1<!!0>), <!!0>
2: int32 class System.Array::FindIndex<!!0> (!!0[], class System.Predicate`1<!!0>), <!!0>
3: int32 class System.Array::FindIndex<!!0> (!!0[], int32, int32, class System.Predicate`1<!!0>), <!!0>
4: int32 class System.Array::FindLastIndex<!!0> (!!0[], int32, int32, class System.Predicate`1<!!0>), <!!0>
5: int32 class System.Array::IndexOf<!!0> (!!0[], !!0, int32, int32), <!!0>
6: int32 class System.Array::LastIndexOf<!!0> (!!0[], !!0, int32, int32), <!!0>
7: void class System.Array::Sort<!!0> (!!0[], int32, int32, class System.Collections.Generic.IComparer`1<!!0>), <!!0>
8: void class System.Array::Sort<!!0, !!1> (!!0[], !!1[], int32, int32, class System.Collections.Generic.IComparer`1<!!0>), <!!0, !!1>
Unhandled loader error: 7, (null) /home/saper/sw/test/DisCrash/rep/mscorlib.dll MangoArraySortHelper`1
* Assertion: should not be reached at loader.c:297

I think decoding of all other tables works (even generic typespecs are fine)
Comment 2 Zoltan Varga 2015-06-28 00:48:42 UTC
monodis cannot disassemble another mscorlib, among a lot of other limitations. Please use the managed 'ikdasm' tool instead.