[Mono-dev] Empty IEnumerable Implementation Crashes C# Compiler
shmuelie
shmueli.yosef at englard.net
Wed Jan 30 16:50:09 UTC 2013
I needed to create a quick and dirty IEnumerable that that had no elements.
To do so I used the following code:
IEnumerator IEnumerable.GetEnumerator ()
{
while(false)
{
yield return string.Empty;
}
}
It compiled and work in .NET 4.0 but when I tried to use the same code in
Mono 4.0 I got the following crash report from the compiler:
Unhandled Exception: Mono.CSharp.InternalErrorException:
/.../MyClass.cs(16,17): <IEnumerable.GetEnumerator>c__Iterator0 --->
System.ArgumentException: Label not marked
at System.Reflection.Emit.ILGenerator.label_fixup () [0x00000] in
<filename unknown>:0
at System.Reflection.Emit.MethodBuilder.fixup () [0x00000] in <filename
unknown>:0
at System.Reflection.Emit.TypeBuilder.CreateType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.ModuleContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename
unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException:
/Users/shmuelienglard/Projects/Learn/DummyEnumeratorCrash/MyClass.cs(16,17):
<IEnumerable.GetEnumerator>c__Iterator0 ---> System.ArgumentException: Label
not marked
at System.Reflection.Emit.ILGenerator.label_fixup () [0x00000] in
<filename unknown>:0
at System.Reflection.Emit.MethodBuilder.fixup () [0x00000] in <filename
unknown>:0
at System.Reflection.Emit.TypeBuilder.CreateType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.TypeContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.ModuleContainer.CloseType () [0x00000] in <filename
unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename
unknown>:0
--
View this message in context: http://mono.1490590.n4.nabble.com/Empty-IEnumerable-Implementation-Crashes-C-Compiler-tp4658346.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list