Bug #42261 Mysql + Compact Framework + VS2005 + "yield" -> compiler error
Submitted: 22 Jan 2009 7:56 Modified: 23 Jun 2009 16:40
Reporter: Beerka Beerka Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: .net, C#, Compact Framework, Visual Studio, VS2005, yield
Triage: D2 (Serious)

[22 Jan 2009 7:56] Beerka Beerka
Description:
I downloaded the mysql-connector-net-5.2.4.zip.
After i added the reference to "C:\Program Files\MySQL\MySQL Connector Net 5.2.4\Compact Framework\MySql.Data.CF.dll" to my project, then i cant build my project anymore, I got microsoft visual c# compiler error.

And after hit the cancel button got this at the error list:

Error 2 The type 'System.Runtime.CompilerServices.CompilerGeneratedAttribute' has no constructors defined MysqlTest
Error 3 Internal Compiler Error (0xc0000005 at address 5A7E3714): likely culprit is 'COMPILE'.

How to repeat:
1. create a simple windows mobile 5.0 project
2. add this to program.cs:

Code Snippet

static string[] strings;

public static IEnumerator<string> GetEnumerator()
{
foreach (string s in strings)
{
yield return s;
}
}

3. add reference to mysql's compact framework based dll
4. build project

Suggested fix:
Dont use yield or use VS2008.
[22 Jan 2009 8:20] Tonci Grgin
Hi Beerka and thanks for your report. Can you please tell me which version of VS2005 are you using?
[22 Jan 2009 10:22] Tonci Grgin
Beerka, I can not repeat your problem with my code so please attach entire test project so I can check.
[22 Jan 2009 10:31] Tonci Grgin
All I managed so far is to crash VS...
[22 Jan 2009 10:51] Beerka Beerka
VS2005 Project

Attachment: MySqlTest.zip (application/zip, text), 10.27 KiB.

[22 Jan 2009 11:14] Tonci Grgin
Thanks Beerka. Your project crashed my VS2005pro much worse than mine did (it's still recovering).
I did not got any error on compilation (just a crash) presumably cause of my environment:
  o Win2K8x64 server, .NET 2.0
  o MySql.Data.CF.csproj built from latest c/NET sources in branches/5.2, debug configuration.

Verified (almost) as described.
[22 Jan 2009 11:18] Tonci Grgin
Nah, had to kill devenv process...
[19 Jun 2009 16:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76735
[19 Jun 2009 16:35] Reggie Burnett
fixed in  5.2.7, 6.0.5+
[23 Jun 2009 16:40] Tony Bedford
Entries were added to both the 5.2.7 and 6.0.5 changelogs:

After a Reference to "C:\Program Files\MySQL\MySQL Connector Net 5.2.4\Compact Framework\MySql.Data.CF.dll" was added to a Windows Mobile 5.0 project, the project then failed to build, generating a Microsoft Visual C# compiler error.

The error generated was:

Error 2 The type 'System.Runtime.CompilerServices.CompilerGeneratedAttribute' 
has no constructors defined MysqlTest
Error 3 Internal Compiler Error (0xc0000005 at address 5A7E3714): 
likely culprit is 'COMPILE'.