Bug #56509 Method not found: 'System.Data.Common.DbConnection.EnlistTransaction'.
Submitted: 2 Sep 2010 17:03 Modified: 18 Nov 2010 14:35
Reporter: Tomas Bosak Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S1 (Critical)
Version:6.3.4 OS:Linux (Mono 2.8)
Assigned to: Reggie Burnett CPU Architecture:Any
Tags: Mono

[2 Sep 2010 17:03] Tomas Bosak
Mono 2.8 comes by default with .Net 4.0 profile and when I try to connect to MySQL database with the newest MySQL .Net connector (6.3.4) I get this exception:

Unhandled Exception: System.MissingMethodException: Method not found:
  at (wrapper remoting-invoke-with-check)
 MySql.Data.MySqlClient.MySqlConnection:Open ()

However when I download source codes of MySQL .Net connector and build it with Visual Studio under target framework version 4.0 the problem is gone. I guess this is more like a feature request to add support for default .Net 4.0 profile under mono 2.8+.

How to repeat:
Try to connect to MySQL database with MySQL .Net connector under mono 2.8 with .Net 4.0 profile.

Suggested fix:
See description.
[2 Sep 2010 17:27] Vladislav Vaintroub
Tomas, to clarify : when you say "profile" you mean NET4.0 Client profile ?
[2 Sep 2010 18:06] Tomas Bosak
By profile I mean version of .Net framework and not client profile. I guess client profile is MS.Net specific thing if I'm not mistaken and this issue is only mono (2.8+) related.
[2 Sep 2010 20:20] Vladislav Vaintroub
Hmm, did you ever tried to report Mono bug on this?

DbConnection.EnlistTransaction is in .NET since 2.0, and Microsoft did not remove it and did not announce any plans to do so (it is in .NET2.0,3.0,3.5 and 4.0) . In fact, it can even have some interesting stuff, and our TransactionScope is dependent on it. While throwing "not implemented" from Mono was not nice in the past, but at least things run if they did not use EnlistTransaction, throwing that  method away completely sounds like a bad idea.
[2 Sep 2010 20:44] Tomas Bosak
At first I thought that it's not present in mono with 4.0 profile so I started thread on mono-dev mailing list:

It doesn't seem to be the issue of mono (at least that's my opinion however I'm little bit confused by some parts), because for example postgres .net connector works without problems. I have tried to modify mono source codes with .net 4.0 symbols on this method and it was still throwing the same exception.
[27 Oct 2010 19:18] j h

I got exactly the same problem on Mac.
But i can't compile MySQL Connector / NET in Visual Studio.
Would you mind uploding your compiled connector?

[27 Oct 2010 19:43] Tomas Bosak
MySQL 6.3.4 Connector .net targeted to .NET 4.0 runtime

Attachment: MySql.Data.dll (application/x-msdownload, text), 379.00 KiB.

[27 Oct 2010 20:31] j h
Thanks for your very quick reply :)
But when i'm trying to add the assembly i got the error ".. is not a valid .NET Assembly.

Any ideas?

[27 Oct 2010 20:51] j h
when i'm trying to add the assembly on Windows the error comes up:
Failure adding assembly MySql.Data.dll to the cache: Attempt to install an assembly without a strong name.

On Mac is works!

Any possbilities to run mysql connector on windows?
[27 Oct 2010 21:01] j h
Well it seems i can add the mysql.dll on mac via gui, but it won't work.
if i try to add it in terminal (gacutil) it will throw the same error as on windows:
Failure adding assembly MySql.Data.dll to the cache: Attemp to install an Assembly without a strong name
[27 Oct 2010 21:15] Tomas Bosak
You have to create strongly named assembly from that .dll when you want to add it to GAC. (http://www.highoncoding.com/Articles/179_A_Look_into_Assemblies_in__NET_Framework.aspx)

I'm using it in web project bin folder, therefore it doesn't have to be strongly named.
[27 Oct 2010 21:36] j h
Thanks again for your quick reply.
I've compiled the MySql.Data.dll with strongly name and i can add the assembly.
But when I'm trying to open the mysql Connection i got this error:
Method not found: "System.Data.Common.DbConnection.EnlistTransaction"

Any ideas again? ;)

[27 Oct 2010 21:43] j h
Sorry my bad, this error just came up because i compiled again with .net 2.0
Now with .net 4.0 i can add it with gacutil, but with gui i cant add it to the project references. (error: MySql.Data.dll is not a valid .NET assembly)

hope i'm not annoying :) but this drives me crazy..

[17 Nov 2010 19:27] 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:

[17 Nov 2010 19:57] Reggie Burnett
fixed in 6.3.6
[18 Nov 2010 14:35] Tony Bedford
An entry has been added to the 6.3.6 changelog:

When using MySQL Connector/NET on Mono 2.8 using .NET 4.0, attempting to connect to a MySQL database generated the following exception:

Unhandled Exception: System.MissingMethodException: Method not found:
  at (wrapper remoting-invoke-with-check)
 MySql.Data.MySqlClient.MySqlConnection:Open ()