Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 13813 [details]
Simple example Visual Studio solution with binaries
When a WCF service is created by the constructor:
public ServiceHost(object singletonInstance, params Uri baseAddresses);
which receives a second argument (an Uri), and if later a MySQL transaction is opened, an *additional* MySQL transaction will be started before the coded one, which causes a MySQL error.
Simply commenting the Uri parameter removes the exception.
Which suggests that the MySQL Connector is being influenced by some WCF code which is crazy. But the behavior is consistent on repeated runs and also on different machines.
Mono versions: 4.0.5, and also 4.0.3
Target .NET version: 4.5.2, 4.0.0, probably all
Linux: LUbuntu 15.10, Debian, probably all
MySQL: 6.9.8 MySQL.Data ADO.NET nuget
Simple test solution is attached. I simply start the exe with mono-service and the error is written to ./error.txt.
System.InvalidOperationException: Nested transactions are not supported.
at MySql.Data.MySqlClient.ExceptionInterceptor.Throw (System.Exception exception) [0x00000] in <filename unknown>:0
at MySql.Data.MySqlClient.MySqlConnection.Throw (System.Exception ex) [0x00000] in <filename unknown>:0
at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction (IsolationLevel iso) [0x00000] in <filename unknown>:0
at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:BeginTransaction ()
at WindowsService1.Service1.OnStart (System.String args) [0x00000] in <filename unknown>:0
The only possibly relevant explanation i could find is this one: https://bugzilla.xamarin.com/show_bug.cgi?id=14844
But that is not even about a database transaction, just some WCF one. Or maybe there is some shared pipe/socket/something where the MySQL driver could see the (posibly identical) BEGIN command and pick it up?
I realize this might just as well be a problem on MySQL's side and will report the bug to them too if you don't find anything in your code. But MySQL should not be reachable from some WCF service code no matter what, so i guess the bug is in their interconnection provided by Mono.
Of course everything works on Windows without Mono or i wouldn't have reported it as a bug.
Mono doesn't ship a MySql driver. You should engage its maintainer instead.