PgSqlConnection.EnlistTransaction throws NotSupportedException

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
EvilShrike
Posts: 19
Joined: Mon 14 Mar 2016 17:11

PgSqlConnection.EnlistTransaction throws NotSupportedException

Post by EvilShrike » Wed 30 Aug 2017 18:29

System.NotSupportedException: Specified method is not supported.
at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)

I'm using Devart.Data.PostgreSql 7.9.958 (trial).
As I can see PgSqlConnection.EnlistTransaction has no implementation any more, so the base method is used and it throws NotSupportedException

Why? It works before (in Express edition).

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Post by Shalex » Thu 31 Aug 2017 09:54

Please specify:
1) are you using the Devart.* assemblies provided with installation (.NET Framework) or downloaded via NuGet (.NET Core)?
2) is your project type .NET Framework or .NET Core?

EvilShrike
Posts: 19
Joined: Mon 14 Mar 2016 17:11

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Post by EvilShrike » Thu 31 Aug 2017 14:41

Assembles were installed via nuget

A project targets both net462 and netcoreapp2.0, EnlistTransaction method fails on both.

the code:

Code: Select all

using System;
using Devart.Data;
namespace devart_sqlite
{
    class Program
    {
        static void Main(string[] args)
        {
            using(var con = new Devart.Data.PostgreSql.PgSqlConnection()) 
            {
            	con.ConnectionString = "...";
            	con.Open();
            	con.EnlistTransaction(System.Transactions.Transaction.Current);
            	Console.WriteLine("opened");
            }
        }
    }
}
Output:

Code: Select all

D:\Work\Learn\dotnet\devart_pgsql>dotnet run -f net462

Unhandled Exception: System.NotSupportedException: Specified method is not supported.
   at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)
   at devart_sqlite.Program.Main(String[] args)

D:\Work\Learn\dotnet\devart_pgsql>dotnet run -f netcoreapp2.0

Unhandled Exception: System.NotSupportedException: Specified method is not supported.
   at System.Data.Common.DbConnection.EnlistTransaction(Transaction transaction)
   at devart_sqlite.Program.Main(String[] args) in D:\Work\Learn\dotnet\devart_pgsql\Program.cs:line 24

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Post by Shalex » Wed 06 Sep 2017 17:37

.NET Standard 1.x (.NET Core 1.x) doesn't support TransactionScope:
https://github.com/dotnet/corefx/issues/2949
https://docs.microsoft.com/en-us/dotnet ... andard-1.3

Referencing .NET Framework assemblies from .NET Standard project will not solve the issue as well because this allows to only use types within the .NET Standard API set. Refer to https://blogs.msdn.microsoft.com/dotnet ... -core-2-0/ > the "Reference .NET Framework libraries from .NET Standard" section.

We will notify you when .NET Core 2.0 is supported by dotConnect for PostgreSQL.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: PgSqlConnection.EnlistTransaction throws NotSupportedException

Post by Shalex » Mon 30 Oct 2017 19:53

.NET Core 2.0 is supported: viewtopic.php?f=3&t=36126.

Post Reply