2
Trying to login through facebook I come across the following error:
Server Error in Application '/'. Undefined object reference for an object instance. Description: An untreated exception occurred during the execution of current web request. Examine stack tracking to get more information about the error and where it originated in the code. Exception Details: System.Nullreferenceexception: Reference of object not defined for an object instance. Line 329: Line 330: // Sign in the user with this External login Provider if the user already has a login Line 331:
var result = await Signinmanager.Externalsigninasync(loginInfo, isPersistent: false); Line 332: switch (result) Line 333: {[Nullreferenceexception: Object reference not defined for a instance of an object.]
Euvotoaf.Controllers.d__26.Movenext() in C: Users Renan Documents visual studio 2015 Projects Euvotoaf Euvotoaf Controllers Accountcontroller.Cs:331
System.Runtime.Compilerservices.TaskAwaiter.Throwfornonsuccess(Task task) +92
System.Runtime.Compilerservices.TaskAwaiter.Handlenonsuccessanddebuggernotification(Task task) +58
System.Web.Mvc.Async.Taskasyncactiondescriptor.Endexecute(Iasyncresult asyncResult) +97
System.Web.Mvc.Async.<>c__DisplayClass37.b__36(Iasyncresult asyncResult) +17
System.Web.Mvc.Async.Wrappedasyncresult1.CallEndDelegate(IAsyncResult asyncResult) +10
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Async.Asynccontrolleractioninvoker.Endinvokeactionmethod(Iasyncresult asyncResult) +32
System.Web.Mvc.Async.Asyncinvocationwithfilters.b__3d() +50 System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +225 System.Web.Mvc.Async.<>c__DisplayClass33.b__32(Iasyncresult asyncResult) +10
System.Web.Mvc.Async.Wrappedasyncresult1.CallEndDelegate(IAsyncResult asyncResult) +10
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Async.Asynccontrolleractioninvoker.Endinvokeactionmethodwithfilters(Iasyncresult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +26 System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(Iasyncresult asyncResult) +100
System.Web.Mvc.Async.Wrappedasyncresult1.CallEndDelegate(IAsyncResult asyncResult) +10
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Async.Asynccontrolleractioninvoker.Endinvokeaction(Iasyncresult asyncResult) +27
System.Web.Mvc.Controller.b__1d(Iasyncresult asyncResult, Executecorestate innerState) +13
System.Web.Mvc.Async.Wrappedasyncvoid1.CallEndDelegate(IAsyncResult asyncResult) +29
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Controller.Endexecutecore(Iasyncresult asyncResult) +36 System.Web.Mvc.Controller.b__15(Iasyncresult asyncResult, Controller) +12
System.Web.Mvc.Async.Wrappedasyncvoid1.CallEndDelegate(IAsyncResult asyncResult) +22
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Controller.Endexecute(Iasyncresult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.Iasynccontroller.Endexecute(Iasyncresult asyncResult) +10
System.Web.Mvc.MvcHandler.b__5(Iasyncresult asyncResult, Processrequeststate innerState) +21
System.Web.Mvc.Async.Wrappedasyncvoid1.CallEndDelegate(IAsyncResult asyncResult) +29
1.End() +49
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.MvcHandler.Endprocessrequest(Iasyncresult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.Ihttpasynchandler.Endprocessrequest(Iasyncresult result) +9
System.Web.Callhandlerexecutionstep.System.Web.HttpApplication.Iexecutionstep.Execute() +9765121 System.Web.Httpapplication.Executestep(Iexecutionstep step, Boolean& completedSynchronously) +155
Threshing the application, I noticed that the error is in the following line:
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
And getting a little more into my class builder ApplicationSignInManager
in the Return of the line:
return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
Is set as Null. One detail that may be important, is that I am customizing the identity
, to use the Guid
as the primary key instead of the default String
.
I put the classes IdentityConfig
and Start.Auth
in the gist for further detail.
How do I fix it ?
The main part of the error was missing: the stack trace
– Jéf Bueno
So
HttpContext.GetOwinContext().Get<ApplicationSignInManager>()
is returningnull
?– Jéf Bueno