Skip to content

TransactionScope in 2.1 throwing exception only during debugging in VS2017 15.7.0 Preview 6.0 #21

Description

@BrotherOdin

While testing the .net core 2.1 implementation of TransactionScope I ran into the following issue.

We have a library that configures settings for DB Connections and Transaction scope (Data.Core). Other libraries call this library to execute queries using dapper.

When I execute the code without the debugger, everything runs fine. When I set a breakpoint in the unit test AND also in the method where the DB connection is opened. I then get the exception below.

Any ideas?

System.PlatformNotSupportedException
  HResult=0x80131539
  Message=This platform does not support distributed transactions.
  Source=System.Transactions.Local
  StackTrace:
   at System.Transactions.Distributed.DistributedTransactionManager.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken)
   at System.Transactions.TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken)
   at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)
   at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)
   at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
   at System.Transactions.Transaction.Promote()
   at System.Transactions.TransactionInterop.ConvertToDistributedTransaction(Transaction transaction)
   at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
   at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)
   at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
   at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Data.Core.DataStore.get_Connection() in D:\TestApps\Repro\Debugger.Issue\Data.Core\DataStore.cs:line 37
   at Data.Core.Tests.ReproTest1.TestMethod1() in D:\TestApps\Repro\Debugger.Issue\Data.Core.Tests\ReproTest1.cs:line 14

This is the test method in Data.Core.Tests:

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Data.Core.Tests
{
    [TestClass]
    public class ReproTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            DataStore ds = new DataStore();
            using (var scope = ds.BeginTransactionScope())
            {
                // Set breakpoint on the following line. 1 of 2 breakpoints.
                var conn = ds.Connection;

                // The following will never be executed in debug

                // Run raw ADO.NET command in the transaction
                var command = conn.CreateCommand();
                command.CommandText = "DELETE FROM dbo.SomeTable";
                command.ExecuteNonQuery();
            }

        }
    }
}

This is DataStore class:

using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Transactions;

namespace Data.Core
{
    using IsolationLevel = System.Transactions.IsolationLevel;

    public class DataStore
    {

        public DataStore()
        {
            this.DatabaseConnectionString = "Data Source=.;Initial Catalog=SomeDB;Integrated Security=True";
        }

        /// <summary>
        /// Gets or sets the database connection string used to create the database connection.
        /// This cannot be null.
        /// </summary>
        private string DatabaseConnectionString { get; set; }

        /// <summary>
        /// Gets the connection. 
        /// </summary>
        public SqlConnection Connection
        {
            get
            {
                // Set breakpoint on the following line. 2 of 2 breakpoints.
                var connection =  new SqlConnection(this.DatabaseConnectionString);
                
                if (connection.State != ConnectionState.Open)
                {
                    // This line will throw exception
                    connection.Open();
                }

                // See if we need to join an existing transaction scope
                if (Transaction.Current != null)
                {
                    ((DbConnection) connection).EnlistTransaction(Transaction.Current);
                }

                return connection;
            }
        }

        /// <inheritdoc />
        public TransactionScope BeginTransactionScope()
        {
            return new TransactionScope(
                TransactionScopeOption.Required, 
                new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted });
        }
    }
}

I have attached a project to reproduce the error.
Debugger.Issue.zip

[EDIT] Add C# syntax highlighting by @karelz

Activity

  1. BrotherOdin commented on May 10, 2018

    @BrotherOdin
    Author

    dotnet --info

    .NET Core SDK (reflecting any global.json):
     Version:   2.1.300-rc1-008673
     Commit:    f5e3ddbe73
    
    Runtime Environment:
     OS Name:     Windows
     OS Version:  6.3.9600
     OS Platform: Windows
     RID:         win81-x64
     Base Path:   C:\Program Files\dotnet\sdk\2.1.300-rc1-008673\
    
    Host (useful for support):
      Version: 2.1.0-rc1
      Commit:  eb9bc92051
    
    .NET Core SDKs installed:
      1.0.0 [C:\Program Files\dotnet\sdk]
      1.0.4 [C:\Program Files\dotnet\sdk]
      1.1.0-preview1-005098 [C:\Program Files\dotnet\sdk]
      1.1.0 [C:\Program Files\dotnet\sdk]
      1.1.8 [C:\Program Files\dotnet\sdk]
      2.0.3 [C:\Program Files\dotnet\sdk]
      2.1.4 [C:\Program Files\dotnet\sdk]
      2.1.104 [C:\Program Files\dotnet\sdk]
      2.1.200-preview-007597 [C:\Program Files\dotnet\sdk]
      2.1.300-rc1-008673 [C:\Program Files\dotnet\sdk]
    
    .NET Core runtimes installed:
      Microsoft.AspNetCore.All 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.App 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.1.0-rc1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    
    To install additional .NET Core runtimes or SDKs:
      https://aka.ms/dotnet-download
    
  2. karelz commented on May 10, 2018

    @karelz
    Member

    Distributed transactions are not supported yet - see #16755

  3. BrotherOdin commented on May 10, 2018

    @BrotherOdin
    Author

    That is part of the bug. This code should never try to elevate to use Distributed transactions. It seems to do it only if you add the breakpoints and stop during debugging.

    If you just execute, there is no Distributed transaction and it works just fine.

  4. jimcarley commented on May 10, 2018

    @jimcarley

    This looks to be an issue with System.Data, based on this part of the callstack:

    at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
    at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)
    at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
    at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)
    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry)
    at System.Data.SqlClient.SqlConnection.Open()

    System.Data is asking for the "ExportCookie" for the transaction. That can only be obtained after promoting the transaction.

    System.Data should be trying to do a Transaction.EnlistPromotableSinglePhase first, before asking for the Export Cookie. But if EnlistPromotableSinglePhase returns "false", that means that a call to EnlistDurable or another EnlistPromotableSinglePhase has already been made for the transaction. This could lead to System.Data trying to get the Export Cookie.

    Adding label for area-System.Data.SqlClient and adding @saurabh500

  5. karelz commented on May 10, 2018

    @karelz
    Member
  6. self-assigned this
    on May 14, 2018
  7. BrotherOdin commented on May 28, 2018

    @BrotherOdin
    Author

    Is this something that will be fixed as part of the 2.1 release?

  8. keeratsingh commented on May 29, 2018

    @keeratsingh

    Hi @BrotherOdin
    I am unable to repro the issue using the repro code you provided in my enviornment, I have stripped down the repro you provided to a bare minimum where it uses .NET SDK Runtime Version 2.1.300-rc1-008673 and SqlClient Version 4.5.0-rc1.
    I have tried both running it via command prompt and placing debug breakpoints using Visual Studio, however I still cannot repro the issue.
    I have attached the Visual Studio solution of the minimal repro, could you kindly try the same and let me know if you see the exception in your environment ?
    adhoc_gh_29633.zip

    PS D:\adhoc_gh_29633> dotnet --info
    .NET Core SDK (reflecting any global.json):
     Version:   2.1.300-rc1-008673
     Commit:    f5e3ddbe73
    
    Runtime Environment:
     OS Name:     Windows
     OS Version:  10.0.17134
     OS Platform: Windows
     RID:         win10-x64
     Base Path:   C:\Program Files\dotnet\sdk\2.1.300-rc1-008673\
    
    Host (useful for support):
      Version: 2.1.0-rc1
      Commit:  eb9bc92051
    
    .NET Core SDKs installed:
      2.1.300-preview2-008533 [C:\Program Files\dotnet\sdk]
      2.1.300-rc1-008673 [C:\Program Files\dotnet\sdk]
    
    .NET Core runtimes installed:
      Microsoft.AspNetCore.All 2.1.0-preview2-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.All 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.App 2.1.0-preview2-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 2.1.0-preview2-26406-04 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.1.0-rc1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    
    To install additional .NET Core runtimes or SDKs:
      https://aka.ms/dotnet-download
    PS D:\adhoc_gh_29633>
    PS D:\adhoc_gh_29633> cat .\adhoc.csproj
    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp2.1</TargetFramework>
        <RuntimeFrameworkVersion>2.1.0-rc1</RuntimeFrameworkVersion>
    
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="System.Data.SqlClient" Version="4.5.0-rc1" />
       </ItemGroup>
    </Project>
    PS D:\adhoc_gh_29633>
  9. BrotherOdin commented on May 30, 2018

    @BrotherOdin
    Author

    I will try it and report back. Stay tuned.

  10. BrotherOdin commented on May 30, 2018

    @BrotherOdin
    Author

    The one in the ZIP is using System.Data.SqlClient (4.6.0-preview1-26529-04) rather than 4.5.0-rc1 so I could not try it.

    Once I update it back to 4.5.0-rc1, I am able to recreate the problem.

    This are the steps I followed.
    Updated adhoc.csproj to use 4.5.0-rc1. (Basically the same as you referenced above)
    Open Visual Studio Enterprise 2017 Preview Version 15.8.0 Preview 6.0
    Open Solution
    Compile
    Set the two breakpoints as indicated in the code
    F5 to Run - Hits first breakpoint
    F10 - To step through until it hits this line: connection.Open();
    Exception thrown.

    We can do an interactive session if you would like. Just let me know.

  11. keeratsingh commented on May 30, 2018

    @keeratsingh

    @BrotherOdin Thank you for the confirmation and detailed steps to repro the issue. I see we differ in OS environments, your logs suggest you are using win81-x64 while I am trying to repro the issue in win10-x64. I will try to setup and repro the issue in win81-x64 environment and get back to you.

  12. StevenRasmussen commented on Jun 1, 2018

    @StevenRasmussen

    I think I'm running into a similar issue... although it's kind of intermittent. Sometimes I'll get the error and sometimes I don't. And it doesn't just happen when a breakpoint is set. I know this doesn't really help with troubleshooting but I wanted to let you know that I'm experiencing it too.

  13. keeratsingh commented on Jun 1, 2018

    @keeratsingh

    @SimplerSoftware Thank you for sharing the information. Could you kindly share your dotnet --info output as well.

  14. StevenRasmussen commented on Jun 1, 2018

    @StevenRasmussen

    @keeratsingh - here you go:

    .NET Core SDK (reflecting any global.json):
     Version:   2.1.300
     Commit:    adab45bf0c
    
    Runtime Environment:
     OS Name:     Windows
     OS Version:  10.0.17134
     OS Platform: Windows
     RID:         win10-x64
     Base Path:   C:\Program Files\dotnet\sdk\2.1.300\
    
    Host (useful for support):
      Version: 2.1.0
      Commit:  caa7b7e2ba
    
    .NET Core SDKs installed:
      1.1.0 [C:\Program Files\dotnet\sdk]
      2.0.0 [C:\Program Files\dotnet\sdk]
      2.0.2 [C:\Program Files\dotnet\sdk]
      2.0.3 [C:\Program Files\dotnet\sdk]
      2.1.1-preview-007094 [C:\Program Files\dotnet\sdk]
      2.1.2 [C:\Program Files\dotnet\sdk]
      2.1.4 [C:\Program Files\dotnet\sdk]
      2.1.100 [C:\Program Files\dotnet\sdk]
      2.1.101 [C:\Program Files\dotnet\sdk]
      2.1.103 [C:\Program Files\dotnet\sdk]
      2.1.104 [C:\Program Files\dotnet\sdk]
      2.1.200-preview-007474 [C:\Program Files\dotnet\sdk]
      2.1.200-preview-007589 [C:\Program Files\dotnet\sdk]
      2.1.200 [C:\Program Files\dotnet\sdk]
      2.1.201 [C:\Program Files\dotnet\sdk]
      2.1.300-preview1-008174 [C:\Program Files\dotnet\sdk]
      2.1.300-rc1-008673 [C:\Program Files\dotnet\sdk]
      2.1.300 [C:\Program Files\dotnet\sdk]
    
    .NET Core runtimes installed:
      Microsoft.AspNetCore.All 2.1.0-preview1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.All 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.App 2.1.0-preview1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 2.1.0-rc1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.1.0-preview1-26216-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.1.0-rc1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

    Edit: Formatted response by @keeratsingh

  15. keeratsingh commented on Jun 6, 2018

    @keeratsingh

    I have setup a Windows 8.1 environment and was able to repro the issue only once against a local 2017 SQLServer, that too on a clean VM, fortunately I was able to capture the dump and trace with the line numbers to have a better picture of the path. I haven't been able to repro this on Windows 10.
    On further investigation while debugging through code I found that System.Data.SqlClient is indeed calling Transaction.EnlistPromotableSinglePhase before it calls GetTransactionCookie.

    • If the EnlistPromotableSinglePhase method call returns true, the exception is not seen.
    • However if I simulate EnlistPromotableSinglePhase were to return false by calling the EnlistNonNull method explicitly again second time, the EnlistPromotableSinglePhase method call returns false, that is when the GetTransactionCookie method gets called and the expection is seen, which is inline with @jimcarley 's comments above.

    Now the above is just a theory, so far which I have not been able to confirm if EnlistNonNull is indeed being called twice, since the issue is not reproable consistently.

    @BrotherOdin Is the issue reproing consistently for you ? Also, to confirm which version of SQLServer are you seeing this issue with, is it local or remote SQLServer ?

       at System.Transactions.Distributed.DistributedTransactionManager.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\DistributedTransaction.cs:line 45
       at System.Transactions.TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionInterop.cs:line 310
       at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionState.cs:line 4542
       at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionState.cs:line 3333
       at System.Transactions.EnlistableStates.Promote(InternalTransaction tx) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionState.cs:line 682
       at System.Transactions.Transaction.Promote() in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\Transaction.cs:line 1131
       at System.Transactions.TransactionInterop.ConvertToDistributedTransaction(Transaction transaction) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionInterop.cs:line 42
       at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) in E:\A\_work\165\s\corefx\src\System.Transactions.Local\src\System\Transactions\TransactionInterop.cs:line 86
       at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlInternalConnection.cs:line 593
       at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlInternalConnection.cs:line 458
       at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPool.cs:line 1228
       at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPool.cs:line 1216
       at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPool.cs:line 1043
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionFactory.cs:line 151
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in E:\A\_work\4\s\corefx\src\Common\src\System\Data\ProviderBase\DbConnectionInternal.cs:line 325
       at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlConnection.cs:line 1153
       at System.Data.SqlClient.SqlConnection.Open() in E:\A\_work\4\s\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlConnection.cs:line 689
       at adhoc.DataStore.get_Connection() in C:\Users\win81user\Downloads\adhoc_gh_29633\adhoc\DataStore.cs:line 38
       at adhoc.gh_29633_TransactionScopeExecption.Main(String[] args) in C:\Users\win81user\Downloads\adhoc_gh_29633\adhoc\gh_29633_TransactionScopeExecption.cs:line 20
  16. 13 remaining items

  17. divega commented on May 15, 2019

    @divega

    As recently announced in the .NET Blog, focus on new SqlClient features an improvements is moving to the new Microsoft.Data.SqlClient package. For this reason, we are moving this issue to the new repo at https://github.com/dotnet/SqlClient. We will still use https://github.com/dotnet/corefx to track issues on other providers like System.Data.Odbc and System.Data.OleDB, and general ADO.NET and .NET data access issues.

  18. transferred this issue fromdotnet/corefxon May 15, 2019
  19. added this to the 1.1.0 milestone on May 20, 2019
  20. coredevsushant commented on May 27, 2019

    @coredevsushant

    do we have any solution
    I am running in same issue
    with .net core 2.2

  21. modified the milestones: 1.1.0, 1.2.0 on Nov 20, 2019
  22. removed this from the 2.0.0 milestone on Jun 18, 2020
  23. cheenamalhotra commented on Nov 3, 2020

    @cheenamalhotra
    Member

    Hi @BrotherOdin @sushantraje2000 @zhangsquall @Alchemy86 @ciragithub

    I tested this issue today with provided repro application and I was able to reproduce issue with EF Core v2.1.0-rc1-final
    But I tried again with EF Core v3.1.9 (tested both netcoreapp2.1 and netcoreapp3.1) that references Microsoft.Data.SqlClient now and this issue seems to be resolved.

    Could someone verify and confirm so we can close this issue?

    Thanks!

  24. cheenamalhotra commented on Aug 5, 2022

    @cheenamalhotra
    Member

    @David-Engel @DavoudEshtehari
    I wonder if this can be closed since there is no activity or reports of the same?

  25. JRahnama commented on Aug 9, 2022

    @JRahnama
    Contributor

    Closing due to inactivity. Feel free to comment if still experiencing the issue.

  26. added a commit that references this issue on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions