Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=81666 --- shadow/81666 2007-05-17 22:14:26.000000000 -0400 +++ shadow/81666.tmp.3999 2007-05-17 22:14:26.000000000 -0400 @@ -0,0 +1,79 @@ +Bug#: 81666 +Product: Mono: Compilers +Version: 1.2 +OS: +OS Details: Ubuntu 7.04 +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: gmcs 1.2.3.1 dies with a NullException when calling Mono.CSharp.Iterator.CheckType() when having IEnumerable<T> in the source code + +The following code makes gmcs gracefuly die with a NullReferenceException : + +<sample code from MSDN> + +using System; +using System.Collections; +public class List +{ + // Changed IEnumerable for IEnumerable<int> + public static IEnumerable<int> Power(int number, int exponent) + { + int counter = 0; + int result = 1; + while (counter++ < exponent) + { + result = result * number; + yield return result; + } + } + + + static void Main() + { + // Display powers of 2 up to the exponent 8: + foreach (int i in Power(2, 8)) + { + Console.Write("{0} ", i); + } + } +} + +</sample code from MSDN> + +When the above code is compiled with gmcs 1.2.3.1, the compiler dies and +its output is : + + +test.cs(6,19): error CS0246: The type or namespace name `IEnumerable`1' +could not be found. Are you missing a using directive or an assembly reference? + +Unhandled Exception: System.NullReferenceException: Object reference not +set to an instance of an object + at Mono.CSharp.Iterator.CheckType (System.Type ret, System.Type& +original_iterator_type, System.Boolean& is_enumerable) [0x00000] + at Mono.CSharp.Iterator.CreateIterator (IMethodData method, +Mono.CSharp.DeclSpace parent, Mono.CSharp.GenericMethod generic, Int32 +modifiers) [0x00000] + at Mono.CSharp.MethodOrOperator.ResolveMembers () [0x00000] + at Mono.CSharp.TypeContainer.DoResolveMembers () [0x00000] + at Mono.CSharp.TypeContainer.ResolveMembers () [0x00000] + at Mono.CSharp.TypeContainer.DefineType () [0x00000] + at Mono.CSharp.Class.DefineType () [0x00000] + at Mono.CSharp.RootContext.ResolveTree () [0x00000] + at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000] + at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] + +Perfectly reproducable + +Changing IEnumerable<int> for IEnumerable makes the compiler happy and the +sample executes perfectly. I do not if this feature is still there in Mono +1.2.4... _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
