title: Microsoft.AspNetCore.Mvc.ViewFeatures.Infrastructure.DefaultTempDataSerializer' cannot serialize an object of type
body: <p>When I'm migrating the .net core application from 2.0 to 3.1, the following method  services.AddCookieTempData() is not working since it's referring  assembly&quot;AspNetCore.Mvc.CookieTempData&quot;. If we comment this code it's showing the below error message. Please let us know what is the alternate for this method.</p>
  <p>public void ConfigureServices(IServiceCollection services)
  {
  services.AddCookieTempData();</p>
  <p>Error Message:
  The 'Microsoft.AspNetCore.Mvc.ViewFeatures.Infrastructure.DefaultTempDataSerializer' cannot serialize an object of type</p>