[Mono-bugs] [Bug 458049] New: GMCS Cannot parse a LINQ query in a static field initializer.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 10 12:44:32 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=458049


           Summary: GMCS Cannot parse a LINQ query in a static field
                    initializer.
           Product: Mono: Compilers
           Version: 2.0.x
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: novell at mountolympus.info
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


Created an attachment (id=259217)
 --> (https://bugzilla.novell.com/attachment.cgi?id=259217)
Simple test classes to demonstrate bug

LINQ Queries compile fine in general, however if I initialize a static field
with a query, the compiler chokes with a very unhelpful "error CS8025: Parsing
error"

For example:
class Test
{
  static Expression DirectExpression = from entity in Query.Manager select
entity;
}

Steps to reproduce the problem:
1. Download TestCase.cs attached 
2. Run the compiler against it "gmcs /target:exe /r:System.Data.Linq
TestCase.cs"


Actual Results:
TestCase.cs(50,74): error CS8025: Parsing error
Compilation failed: 1 error(s), 0 warnings

Expected Results:
2 warnings, but a successful compilation. 
Execution will throw an exception, but I'm only concerned with compilation in
this test case.

How often does this happen? 
Every time.

Additional Information:
The accompanied class compiles fine in Visual Studio 2008.  I've included a
static function that returns the same query to demonstrate that the same query
syntax compiles fine withing a function scope.


-- 
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