You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
The first request succeeds. Subsequent requests fail with the following exception:
System.ArgumentNullException was unhandled by user code
HResult=-2147467261
Message=Value cannot be null.
Parameter name: dictionary
ParamName=dictionary
Source=System.Private.CoreLib
StackTrace:
at System.Collections.Generic.Dictionary`2..ctor(IDictionary`2 dictionary, IEqualityComparer`1 comparer)
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.LoadTempData(HttpContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Load()
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.set_Item(String key, Object value)
at WebApplication3.Controllers.HomeController.Index() in c:\users\dedward\documents\visual studio 2015\Projects\WebApplication3\src\WebApplication3\Controllers\HomeController.cs:line 13
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext()
InnerException:
The text was updated successfully, but these errors were encountered:
OK this is even worse. It seems to happen if you set it to anything other than a value type, e.g. the same thing happens with the following: TempData["WhatWillThisDo"] = new object();
I'm guessing we don't want that to work, but I'm also guessing we don't want it to fail this way.
We should understand why this is blowing up. If this is something that shouldn't be supported then we should throw a better exception. If bug then fix.
Repro steps
Create a new MVC application
Configure it to use session so that
TempData
worksMicrosoft.AspNetCore.Session
Startup.ConfigureServices
to add the session servicesservices.AddSession()
Startup.Configure
to add the session middlewareapp.UseSession()
Modify
HomeController.Index
to insert a null value intoTempData
:Run the app
Expected
The value at the specified key is cleared.
Actual
The first request succeeds. Subsequent requests fail with the following exception:
The text was updated successfully, but these errors were encountered: