{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/26965","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/26965/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/26965/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/26965/events","html_url":"https://github.com/dotnet/corefx/issues/26965","id":295637938,"number":26965,"title":"Crash in SqlConnection.Close() when using TransactionScope on linux.","user":{"login":"evgeniylevakhin","id":9441349,"avatar_url":"https://avatars0.githubusercontent.com/u/9441349?v=4","gravatar_id":"","url":"https://api.github.com/users/evgeniylevakhin","html_url":"https://github.com/evgeniylevakhin","followers_url":"https://api.github.com/users/evgeniylevakhin/followers","following_url":"https://api.github.com/users/evgeniylevakhin/following{/other_user}","gists_url":"https://api.github.com/users/evgeniylevakhin/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeniylevakhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeniylevakhin/subscriptions","organizations_url":"https://api.github.com/users/evgeniylevakhin/orgs","repos_url":"https://api.github.com/users/evgeniylevakhin/repos","events_url":"https://api.github.com/users/evgeniylevakhin/events{/privacy}","received_events_url":"https://api.github.com/users/evgeniylevakhin/received_events","type":"User","site_admin":false},"labels":[{"id":335854516,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Data.SqlClient","name":"area-System.Data.SqlClient","color":"d4c5f9","default":false},{"id":205613977,"url":"https://api.github.com/repos/dotnet/corefx/labels/os-linux","name":"os-linux","color":"fef2c0","default":false},{"id":375936824,"url":"https://api.github.com/repos/dotnet/corefx/labels/tenet-reliability","name":"tenet-reliability","color":"c2e0c6","default":false}],"state":"closed","locked":false,"assignee":{"login":"keeratsingh","id":2684055,"avatar_url":"https://avatars0.githubusercontent.com/u/2684055?v=4","gravatar_id":"","url":"https://api.github.com/users/keeratsingh","html_url":"https://github.com/keeratsingh","followers_url":"https://api.github.com/users/keeratsingh/followers","following_url":"https://api.github.com/users/keeratsingh/following{/other_user}","gists_url":"https://api.github.com/users/keeratsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/keeratsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keeratsingh/subscriptions","organizations_url":"https://api.github.com/users/keeratsingh/orgs","repos_url":"https://api.github.com/users/keeratsingh/repos","events_url":"https://api.github.com/users/keeratsingh/events{/privacy}","received_events_url":"https://api.github.com/users/keeratsingh/received_events","type":"User","site_admin":false},"assignees":[{"login":"keeratsingh","id":2684055,"avatar_url":"https://avatars0.githubusercontent.com/u/2684055?v=4","gravatar_id":"","url":"https://api.github.com/users/keeratsingh","html_url":"https://github.com/keeratsingh","followers_url":"https://api.github.com/users/keeratsingh/followers","following_url":"https://api.github.com/users/keeratsingh/following{/other_user}","gists_url":"https://api.github.com/users/keeratsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/keeratsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keeratsingh/subscriptions","organizations_url":"https://api.github.com/users/keeratsingh/orgs","repos_url":"https://api.github.com/users/keeratsingh/repos","events_url":"https://api.github.com/users/keeratsingh/events{/privacy}","received_events_url":"https://api.github.com/users/keeratsingh/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/12","html_url":"https://github.com/dotnet/corefx/milestone/12","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/12/labels","id":2323293,"number":12,"title":"2.1.0","description":".NET Core 2.1, next major release. See [official release dates](https://github.com/dotnet/core/blob/master/roadmap.md) for details.","creator":{"login":"karelz","id":5776068,"avatar_url":"https://avatars2.githubusercontent.com/u/5776068?v=4","gravatar_id":"","url":"https://api.github.com/users/karelz","html_url":"https://github.com/karelz","followers_url":"https://api.github.com/users/karelz/followers","following_url":"https://api.github.com/users/karelz/following{/other_user}","gists_url":"https://api.github.com/users/karelz/gists{/gist_id}","starred_url":"https://api.github.com/users/karelz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karelz/subscriptions","organizations_url":"https://api.github.com/users/karelz/orgs","repos_url":"https://api.github.com/users/karelz/repos","events_url":"https://api.github.com/users/karelz/events{/privacy}","received_events_url":"https://api.github.com/users/karelz/received_events","type":"User","site_admin":false},"open_issues":247,"closed_issues":5120,"state":"open","created_at":"2017-02-15T02:14:11Z","updated_at":"2018-02-28T09:10:36Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2018-02-08T19:32:53Z","updated_at":"2018-02-28T09:10:36Z","closed_at":"2018-02-28T09:10:36Z","author_association":"NONE","body":"I'm using SqlClient 4.5.0-preview1-26207-04 in netcoreapp2.0.\r\n\r\n```\r\n.NET Command Line Tools (2.0.0)\r\n\r\nProduct Information:\r\n Version:            2.0.0\r\n Commit SHA-1 hash:  cdcd1928c9\r\n\r\nRuntime Environment:\r\n OS Name:     centos\r\n OS Version:  7\r\n OS Platform: Linux\r\n RID:         centos.7-x64\r\n Base Path:   /usr/share/dotnet/sdk/2.0.0/\r\n\r\nMicrosoft .NET Core Shared Framework Host\r\n\r\n  Version  : 2.0.0\r\n  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d\r\n```\r\n\r\nThe following snippet would crash on the above machine (removed some code for brevity). Works without issues on Windows.\r\n\r\n```c#\r\nusing (var txscope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))\r\n                using (var cn = _dBProvider.GetWriteConnection())\r\n                {\r\n                    await cn.OpenAsync();\r\n\r\n                    if (cmd.RecordCertificationStatus)\r\n                    {\r\n                        await cn.ExecuteAsync(@\"INSERT INTO (...) (@iduser, @idtitle, @value, getdate()); \", \r\n                            new { @iduser = cmd.SubId, @idtitle=cmd.EntityId, @value = cmd.Model.IsCertified });\r\n                    }\r\n                    await cn.ExecuteAsync(sql, data);\r\n                    txscope.Complete();\r\n                }\r\n```\r\n\r\n\r\nBoth statements are inserts. Stacktrace is below:\r\n\r\n```\r\n \"System.NullReferenceException: Object reference not set to an instance of an object.\r\n                at System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInternal obj)\r\n                at System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal obj, Object owningObject)\r\n                at System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection owningObject, DbConnectionFactory connectionFactory)\r\n                at System.Data.SqlClient.SqlConnection.Close()\r\n                at System.Data.SqlClient.SqlConnection.Dispose(Boolean disposing)\r\n                at System.ComponentModel.Component.Dispose()\r\n                at ...TitleUpdate.Handler.<HandleCore>d__2.MoveNext() in ...TitleUpdate.cs:line 189\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at MediatR.Internal.RequestHandlerWrapperImpl`1.<>c__DisplayClass0_0.<<Handle>g__Handler0>d.MoveNext()\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n                at ...ValidationBehavior`2.<Handle>d__2.MoveNext() in ...ValidationBehavior.cs:line 34\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at ....TitlesController.<Update>d__5.MoveNext() in TitleController.cs:line 98\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n                at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n                at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()\r\n                --- End of stack trace from previous location where exception was thrown ---\r\n                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n                at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n                at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()\"\r\n```"}}
{"actor":{"display_login":"saurabh500"}}