Bug 25690

Summary: * Assertion: should not be reached at icall.c:1902
Product: [Mono] Runtime Reporter: Marek Safar <masafa>
Component: ReflectionAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+runtime, vargaz
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Marek Safar 2015-01-03 03:38:30 UTC
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
using System.IO;

namespace cons234234324
{

	class MainClass
	{
		public static void Main(string[] args)
		{
			var assembly = Thread.GetDomain ().DefineDynamicAssembly (new AssemblyName ("ASSEMBLY_NAME"), AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
			var module = assembly.DefineDynamicModule ("Instance.exe");
			EnumBuilder enumBuilder = module.DefineEnum ("gggg",
				TypeAttributes.Public, typeof(int));
			enumBuilder.DefineLiteral ("TF", 4);

			enumBuilder.CreateType ();

			var fields = enumBuilder.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

			for (int i = 0; i < fields.Length; ++i) {
				var m = fields[i].GetRawConstantValue ();
			}

			var n0 = enumBuilder.GetEnumName (4);
		}
	}
}

When run mono fails with

* Assertion: should not be reached at icall.c:1902

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoField.GetRawConstantValue (System.Reflection.MonoField) <IL 0x0002d, 0xffffffff>
  at cons234234324.MainClass.Main (string[]) [0x0006e] in /Users/marek/Projects/c2/c2/Program.cs:25
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Comment 1 Zoltan Varga 2015-01-03 06:48:42 UTC
Fixed in master.