{"action":"closed","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/666","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/666/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/666/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/666/events","html_url":"https://github.com/npgsql/npgsql/issues/666","id":94860420,"number":666,"title":"System.InvalidOperationException with ASP.NET MVC, EF6 and npgsql 3 rc1","user":{"login":"matthewrwilton","id":1552033,"avatar_url":"https://avatars.githubusercontent.com/u/1552033?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewrwilton","html_url":"https://github.com/matthewrwilton","followers_url":"https://api.github.com/users/matthewrwilton/followers","following_url":"https://api.github.com/users/matthewrwilton/following{/other_user}","gists_url":"https://api.github.com/users/matthewrwilton/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrwilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrwilton/subscriptions","organizations_url":"https://api.github.com/users/matthewrwilton/orgs","repos_url":"https://api.github.com/users/matthewrwilton/repos","events_url":"https://api.github.com/users/matthewrwilton/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrwilton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/npgsql/npgsql/labels/bug","name":"bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"roji","id":1862641,"avatar_url":"https://avatars.githubusercontent.com/u/1862641?v=3","gravatar_id":"","url":"https://api.github.com/users/roji","html_url":"https://github.com/roji","followers_url":"https://api.github.com/users/roji/followers","following_url":"https://api.github.com/users/roji/following{/other_user}","gists_url":"https://api.github.com/users/roji/gists{/gist_id}","starred_url":"https://api.github.com/users/roji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roji/subscriptions","organizations_url":"https://api.github.com/users/roji/orgs","repos_url":"https://api.github.com/users/roji/repos","events_url":"https://api.github.com/users/roji/events{/privacy}","received_events_url":"https://api.github.com/users/roji/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/npgsql/npgsql/milestones/3","html_url":"https://github.com/npgsql/npgsql/milestones/3.0","labels_url":"https://api.github.com/repos/npgsql/npgsql/milestones/3/labels","id":620657,"number":3,"title":"3.0","description":"","creator":{"login":"franciscojunior","id":829924,"avatar_url":"https://avatars.githubusercontent.com/u/829924?v=3","gravatar_id":"","url":"https://api.github.com/users/franciscojunior","html_url":"https://github.com/franciscojunior","followers_url":"https://api.github.com/users/franciscojunior/followers","following_url":"https://api.github.com/users/franciscojunior/following{/other_user}","gists_url":"https://api.github.com/users/franciscojunior/gists{/gist_id}","starred_url":"https://api.github.com/users/franciscojunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franciscojunior/subscriptions","organizations_url":"https://api.github.com/users/franciscojunior/orgs","repos_url":"https://api.github.com/users/franciscojunior/repos","events_url":"https://api.github.com/users/franciscojunior/events{/privacy}","received_events_url":"https://api.github.com/users/franciscojunior/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2014-04-04T16:37:19Z","updated_at":"2015-07-15T19:02:08Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-07-14T03:33:50Z","updated_at":"2015-07-15T19:02:08Z","closed_at":"2015-07-15T19:02:08Z","body":"Hi\r\n\r\nI am getting an exception when trying to use the version 3 rc1 EF library, because of a call to an async void method. The method in question is NpgsqlConnectorPool.ReleaseConnector.\r\n\r\nTo reproduce the error I started with the ASP.NET MVC template, set it up to use npgsql, added a new model, and scaffolded a controller and views for the model. I see the exception when I navigate to the index view for the model.\r\n\r\nI tested the same code with an edited version of npgsql, where I had changed the NpgsqlConnectorPool.ReleaseConnector method to not be async. This worked with no exception.\r\n\r\nThe versions of the libraries I am using are\r\n- EntityFramework 6.1.3\r\n- Npgsql 3.0.0-rc0001\r\n- EntityFramework6.Npgsql 3.0.0-rc0001\r\n\r\nThe full details of the exception are\r\n\r\n    InvalidOperationException: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async=\"true\" %>. This exception may also indicate an attempt to call an \"async void\" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.\r\n       System.Web.AspNetSynchronizationContext.OperationStarted() +4962894\r\n       System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Create() +180\r\n       Npgsql.NpgsqlConnectorPool.ReleaseConnector(NpgsqlConnection connection, NpgsqlConnector connector) +225\r\n       Npgsql.NpgsqlConnection.ReallyClose() +391\r\n       Npgsql.NpgsqlConnection.Close() +242\r\n       Npgsql.NpgsqlConnection.Dispose(Boolean disposing) +95\r\n       System.ComponentModel.Component.Dispose() +27\r\n       System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Dispose>b__c(DbConnection t, DbConnectionInterceptionContext c) +102\r\n       System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +269\r\n       System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Dispose(DbConnection connection, DbInterceptionContext interceptionContext) +653\r\n       System.Data.Entity.Internal.RepositoryBase.DisposeConnection(DbConnection connection) +169\r\n       System.Data.Entity.Migrations.History.HistoryRepository.QueryExists(String contextKey) +1680\r\n       System.Data.Entity.Migrations.History.HistoryRepository.Exists(String contextKey) +137\r\n       System.Data.Entity.Migrations.History.HistoryRepository.GetLastModel(String& migrationId, String& productVersion, String contextKey) +167\r\n       System.Data.Entity.Internal.InternalContext.QueryForModel(DatabaseExistenceState existenceState) +113\r\n       System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata, DatabaseExistenceState existenceState) +177\r\n       System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata, DatabaseExistenceState existenceState) +171\r\n       System.Data.Entity.Database.CompatibleWithModel(Boolean throwIfNoMetadata, DatabaseExistenceState existenceState) +83\r\n       System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +362\r\n       System.Data.Entity.Internal.<>c__DisplayClassf`1.<CreateInitializationAction>b__e() +222\r\n       System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +116\r\n       System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +748\r\n       System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +48\r\n       System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +238\r\n       System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +424\r\n       System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +165\r\n       System.Data.Entity.Internal.InternalContext.Initialize() +70\r\n       System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +45\r\n       System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +155\r\n       System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +50\r\n       System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +160\r\n       System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +446\r\n       System.Linq.Enumerable.ToList(IEnumerable`1 source) +80\r\n       Npgsql3Test.Controllers.DummiesController.Index() in c:\\Users\\ValourAndArms\\Documents\\Visual Studio 2013\\Projects\\Npgsql3Test\\Npgsql3Test\\Controllers\\DummiesController.cs:20\r\n       lambda_method(Closure , ControllerBase , Object[] ) +113\r\n       System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +81\r\n       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +752\r\n       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +93\r\n       System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod() +90\r\n       System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +45\r\n       System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +211\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +141\r\n       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +65\r\n       System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +189\r\n       System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717\r\n       System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +66\r\n       System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +71\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +141\r\n       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +65\r\n       System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +103\r\n       System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +330\r\n       System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +71\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +73\r\n       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +58\r\n       System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +90\r\n       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +188\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +73\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50\r\n       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +68\r\n       System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +60\r\n       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +85\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +73\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50\r\n       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +58\r\n       System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +60\r\n       System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +93\r\n       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +188\r\n       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +73\r\n       System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50\r\n       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +58\r\n     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +59\r\n       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606\r\n       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288\r\n"}}