Bug 8364 - mono-2-10: class.c:1767, condition `class->image->dynamic || field->offset > 0' not met
Summary: mono-2-10: class.c:1767, condition `class->image->dynamic || field->offset > ...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-11-13 04:07 UTC by David Schmitt
Modified: 2012-11-13 07:14 UTC (History)
1 user (show)

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

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 David Schmitt 2012-11-13 04:07:43 UTC
When using nullable references to generic structs, the dmcs compiler hits a bug in the runtime:

[mono-2-10] jenkins@jenkins:~/tmp/empty-struct$ dmcs /t:library empty-struct.cs
* Assertion at class.c:1767, condition `class->image->dynamic || field->offset > 0' not met

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 () <0x0043f>
  at Mono.CSharp.TypeContainer.CloseType () <0x001c3>
  at Mono.CSharp.ModuleContainer.CloseType () <0x00072>
  at Mono.CSharp.Driver.Compile () <0x00535>
  at Mono.CSharp.Driver.Main (string[]) <0x000c3>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>


The repro case is very simple:

public class Test {
        public EmptyStruct<string>? field;
}

public struct EmptyStruct<T> { }

The error vanishes if the Nullable is removed. It compiles without problems under MS.NET. It doesn't happen on mono 3.0.
Comment 1 Marek Safar 2012-11-13 07:14:39 UTC
Closing as fixed in 3.0