Bug 28053 - System.Transactions.Transaction doesn't pay attention to the IsolationLevel
Summary: System.Transactions.Transaction doesn't pay attention to the IsolationLevel
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Transactions ()
Version: 3.12.0
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-03-16 08:07 UTC by Andrey
Modified: 2018-03-13 11:59 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Simple code to reproduce bug. (973 bytes, text/plain)
2015-03-16 08:07 UTC, Andrey

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 28053 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Andrey 2015-03-16 08:07:40 UTC
Created attachment 10354 [details]
Simple code to reproduce bug.

Current implementation of System.Transactions.Transaction class uses only Serializable isolation level and you have not any way to change it.

Even if you use TransactionScope and give required IsolationLevel using TransactionOptions this has no effect (see sample code in attachment).

In my case it causes many concurrent Serializable transactions in PostgreSQL. This DBMS interprates "Serializable isolation level" as "pretend that all transactions run one after other, despite the fact that really they run in parallel. If this utopia for the specific transaction cannot continue - rollback it with serializable error". So almost all my transactions fails, but work perfectly in .Net using READ COMMITTED isolation level.

As I can see in the source code on github, it can be easy fixed. Now class Transaction has parameterless constructor which set Serializable isolation level. This constructor used in TransactionScope class. All fix is to replace it with Transaction(IsolationLevel level) constructor.

But, maybe, it's necessary to consider TransactionOptions.Timeout at the same time.