Bug 2502 - Compiler crashes with assertion: condition `class->image->dynamic || field->offset > 0' not met
Summary: Compiler crashes with assertion: condition `class->image->dynamic || field->o...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
Depends on:
Blocks:
 
Reported: 2011-12-14 16:01 UTC by jesse.attas
Modified: 2013-07-26 14:14 UTC (History)
2 users (show)

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


Attachments
Project and two source files that reproduce the crash (2.63 KB, application/zip)
2011-12-14 16:01 UTC, jesse.attas
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 FIXED

Description jesse.attas 2011-12-14 16:01:43 UTC
Created attachment 1045 [details]
Project and two source files that reproduce the crash

When I try to build the attached project in MonoTouch, the compiler reports "Error: The compiler appears to have crashed. Check the build output pad for details."

In the attached project if I remove and re-add Default'TData.cs, the crash is fixed. The only difference between the project files is that the non-crash one has an extra entry for the "Internal" folder:
    <Folder Include="Internal\" />

I'm using 
Mono 2.10.6
MonoTouch: 5.0.4
MonoDevelop 2.8.5

The build output is as follows:
Building: Controls.MonoTouch (Debug)

Building Solution Controls.MonoTouch

Building: Controls.MonoTouch (Debug)

Performing main compilation...
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/jattas/Desktop/crash 2/bin/Debug/Controls.MonoTouch.csproj.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 "/define:DEBUG;MONO"  /t:library "/Users/jattas/Desktop/crash 2/Internal/Default`TData.cs" "/Users/jattas/Desktop/crash 2/Range`TData.cs" 
* Assertion at ../../../../../mono/mono/metadata/class.c:1739, condition `class->image->dynamic || field->offset > 0' not met


/Users/jattas/Desktop/crash 2/Internal/Default`TData.cs(5,38): warning CS0169: The private field `A.B.C.Default<TData>._range' is never used
Stacktrace:

  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.CreateType () <0x0039f>
  at Mono.CSharp.TypeContainer.CloseType () <0x0019b>
  at Mono.CSharp.ModuleContainer.CloseType () <0x00080>
  at Mono.CSharp.Driver.Compile () <0x0047e>
  at Mono.CSharp.Driver.Main (string[]) <0x000af>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   mono                                0x000e1943 mono + 919875
	1   mono                                0x001545fd mono + 1390077
	2   libsystem_c.dylib                   0x97b2559b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x97ac0bdd abort + 167
	5   mono                                0x002cb873 mono + 2926707
	6   mono                                0x002cb906 mono + 2926854
	7   mono                                0x0016a43c mono + 1479740
	8   mono                                0x00169c11 mono + 1477649
	9   mono                                0x00172bf4 mono + 1514484
	10  mono                                0x00169cc0 mono + 1477824
	11  mono                                0x00169f90 mono + 1478544
	12  mono                                0x00253e98 mono + 2436760
	13  mono                                0x002550a6 mono + 2441382
	14  ???                                 0x0381b28c 0x0 + 58831500
	15  ???                                 0x0381ad88 0x0 + 58830216
	16  ???                                 0x0381a71c 0x0 + 58828572
	17  ???                                 0x0381a3d9 0x0 + 58827737
	18  ???                                 0x01620cef 0x0 + 23203055
	19  ???                                 0x0067cda8 0x0 + 6802856
	20  ???                                 0x0067d1a6 0x0 + 6803878
	21  mono                                0x0001114f mono + 65871
	22  mono                                0x0022203a mono + 2232378
	23  mono                                0x00224d1c mono + 2243868
	24  mono                                0x00223f81 mono + 2240385
	25  mono                                0x000acecf mono + 704207
	26  mono                                0x000ad120 mono + 704800
	27  mono                                0x000af584 mono + 714116
	28  mono                                0x000026e4 mono + 5860
	29  mono                                0x00002778 mono + 6008
	30  mono                                0x00002495 mono + 5269

Debug info from gdb:

/tmp/mono-gdb-commands.nLIe3G:1: Error in sourced command file:
unable to debug self

=================================================================
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.
=================================================================

/Developer/MonoTouch/usr/bin/smcs: line 3:  5366 Abort trap: 6           MONO_PATH=/Developer/MonoTouch/usr/lib/mono/2.1 /Developer/MonoTouch/usr/bin/mono /Developer/MonoTouch/usr/lib/mono/2.1/smcs.exe "$@"


/Users/jattas/Desktop/crash 2/Internal/Default`TData.cs(5,38): warning CS0169: The private field `A.B.C.Default<TData>._range' is never used
Stacktrace:

  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.CreateType () <0x0039f>
  at Mono.CSharp.TypeContainer.CloseType () <0x0019b>
  at Mono.CSharp.ModuleContainer.CloseType () <0x00080>
  at Mono.CSharp.Driver.Compile () <0x0047e>
  at Mono.CSharp.Driver.Main (string[]) <0x000af>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   mono                                0x000e1943 mono + 919875
	1   mono                                0x001545fd mono + 1390077
	2   libsystem_c.dylib                   0x97b2559b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x97ac0bdd abort + 167
	5   mono                                0x002cb873 mono + 2926707
	6   mono                                0x002cb906 mono + 2926854
	7   mono                                0x0016a43c mono + 1479740
	8   mono                                0x00169c11 mono + 1477649
	9   mono                                0x00172bf4 mono + 1514484
	10  mono                                0x00169cc0 mono + 1477824
	11  mono                                0x00169f90 mono + 1478544
	12  mono                                0x00253e98 mono + 2436760
	13  mono                                0x002550a6 mono + 2441382
	14  ???                                 0x0381b28c 0x0 + 58831500
	15  ???                                 0x0381ad88 0x0 + 58830216
	16  ???                                 0x0381a71c 0x0 + 58828572
	17  ???                                 0x0381a3d9 0x0 + 58827737
	18  ???                                 0x01620cef 0x0 + 23203055
	19  ???                                 0x0067cda8 0x0 + 6802856
	20  ???                                 0x0067d1a6 0x0 + 6803878
	21  mono                                0x0001114f mono + 65871
	22  mono                                0x0022203a mono + 2232378
	23  mono                                0x00224d1c mono + 2243868
	24  mono                                0x00223f81 mono + 2240385
	25  mono                                0x000acecf mono + 704207
	26  mono                                0x000ad120 mono + 704800
	27  mono                                0x000af584 mono + 714116
	28  mono                                0x000026e4 mono + 5860
	29  mono                                0x00002778 mono + 6008
	30  mono                                0x00002495 mono + 5269

Debug info from gdb:

/tmp/mono-gdb-commands.nLIe3G:1: Error in sourced command file:
unable to debug self

=================================================================
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.
=================================================================

/Developer/MonoTouch/usr/bin/smcs: line 3:  5366 Abort trap: 6           MONO_PATH=/Developer/MonoTouch/usr/lib/mono/2.1 /Developer/MonoTouch/usr/bin/mono /Developer/MonoTouch/usr/lib/mono/2.1/smcs.exe "$@"
Build complete -- 1 error, 1 warning

---------------------- Done ----------------------

Build: 1 error, 1 warning
Comment 1 Marek Safar 2012-04-24 03:39:05 UTC
SRE issue, master works nicely
Comment 2 Miguel de Icaza [MSFT] 2013-07-26 14:14:56 UTC
This should be fixed in our latest release in stable.