[Mono-bugs] [Bug 389795] New: gmcs fails to resolve anonymous type when it is under conflict with namespace
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue May 13 09:18:37 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=389795
Summary: gmcs fails to resolve anonymous type when it is under
conflict with namespace
Product: Mono: Compilers
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: atsushi at ximian.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
The following example that uses linq to DataSet fails to compile:
----
using System;
using System.Data;
using System.Linq;
namespace MonoTests.System.Data // this is the key
{
public class Test
{
public static void Main ()
{
var q = from line in new DataTable ().AsEnumerable ()
where line.Field<int> ("Score") > 80
select new {
ID = line.Field<int> ("ID"),
Score = line.Field<int> ("Score") };
}
}
}
----
To build it, you need System.Data.DataSetExtensions.dll installed; go to
mcs/class/System.Data.DataSetExtensions and run "make PROFILE=net_2_0 install"
Then compile as: gmcs foobar.cs -r:System.Core -r:System.Data
-r:System.Data.DataSetExtensions
Actual result:
gmcs eno.cs -r:System.Core -r:System.Data -r:System.Data.DataSetExtensions
eno.cs(11,29): warning CS0168: The variable `q' is declared but never used
Unhandled Exception: System.InvalidOperationException: Method
'<>__AnonType0`2.g
et_ID' does not have a method body.
at System.Reflection.Emit.MethodBuilder.fixup () [0x00000]
at System.Reflection.Emit.TypeBuilder.CreateType () [0x00000]
at Mono.CSharp.RootContext.CloseTypes () [0x00000]
at Mono.CSharp.Driver.Compile () [0x00000]
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]
Expected result:
compiles fine.
Additional comment:
It does not happen if the namespace does not include "System" (MonoTests is
okay; MonoTests.System is not; MonoTests.System.Data is not either, as above)
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list