none
Value cannot be null. Parameter name: key RRS feed

  • Question

  • Hello there,

    I am getting below error intermittently in my ASP.NET MVC project which used entity framework.

    Please note it is working fine from my localhost however in the dev environment(AWS Server) it is giving error and I am afraid it might occur in the production env as well.

    System.ArgumentNullException
    Value cannot be null. Parameter name: key

    at System.ThrowHelper.Void ThrowArgumentNullException(System.ExceptionArgument)()
    at System.Collections.Generic.Dictionary`2.Int32 FindEntry(TKey)()
    at System.Collections.Generic.Dictionary`2.Boolean ContainsKey(TKey)()
    at Microsoft.Practices.Unity.UnityContainer.Void FillTypeRegistrationDictionary(System.Collections.Generic.IDictionary`2[System.Type,System.Collections.Generic.List`1[System.String]])()
    at Microsoft.Practices.Unity.UnityContainer.Void FillTypeRegistrationDictionary(System.Collections.Generic.IDictionary`2[System.Type,System.Collections.Generic.List`1[System.String]])()
    at Microsoft.Practices.Unity.UnityContainer.System.Collections.Generic.IEnumerable`1[Microsoft.Practices.Unity.ContainerRegistration] get_Registrations()()
    at Microsoft.Practices.Unity.UnityContainerExtensions.Boolean IsRegistered(Microsoft.Practices.Unity.IUnityContainer, System.Type, System.String)()
    at Microsoft.Practices.Unity.UnityContainerExtensions.Boolean IsRegistered(Microsoft.Practices.Unity.IUnityContainer, System.Type)()
    at Unity.Mvc5.UnityDependencyResolver.Boolean IsRegistered(System.Type)()
    at Unity.Mvc5.UnityDependencyResolver.System.Object GetService(System.Type)()
    at System.Collections.Concurrent.ConcurrentDictionary`2.TValue GetOrAdd(TKey, System.Func`2[TKey,TValue])()
    at System.Web.Mvc.DependencyResolver+CacheDependencyResolver.System.Object GetService(System.Type)()
    at System.Web.Mvc.DependencyResolverExtensions.TService GetService[TService](System.Web.Mvc.IDependencyResolver)()
    at System.Web.Mvc.Controller.System.Web.Mvc.ITempDataProvider CreateTempDataProvider()()
    at System.Web.Mvc.Controller.System.Web.Mvc.ITempDataProvider get_TempDataProvider()()
    at System.Web.Mvc.Controller.Void PossiblyLoadTempData()()
    at System.Web.Mvc.Controller.System.IAsyncResult BeginExecuteCore(System.AsyncCallback, System.Object)()
    at ValueTrack.Controllers.ManageClientController.System.IAsyncResult BeginExecuteCore(System.AsyncCallback, System.Object)()
    at System.Web.Mvc.Controller.System.IAsyncResult b__14(System.AsyncCallback, System.Object, System.Web.Mvc.Controller)()
    at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncVoid`1.System.IAsyncResult CallBeginDelegate(System.AsyncCallback, System.Object)()
    at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1.Void Begin(System.AsyncCallback, System.Object, Int32)()
    at System.Web.Mvc.Async.AsyncResultWrapper.System.IAsyncResult Begin[TState](System.AsyncCallback, System.Object, System.Web.Mvc.Async.BeginInvokeDelegate`1[TState], System.Web.Mvc.Async.EndInvokeVoidDelegate`1[TState], TState, System.Object, Int32, System.Threading.SynchronizationContext)()
    at System.Web.Mvc.Controller.BeginExecute()
    at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute()
    at System.Web.Mvc.MvcHandler.b__3()
    at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncVoid`1.CallBeginDelegate()
    at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1.Begin()
    at System.Web.Mvc.Async.AsyncResultWrapper.Begin()
    at System.Web.Mvc.MvcHandler.BeginProcessRequest()
    at System.Web.Mvc.MvcHandler.BeginProcessRequest()
    at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest()
    at System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep()
    at System.Web.HttpApplication+PipelineStepManager.ResumeSteps()
    at System.Web.HttpApplication.ResumeSteps()
    at System.Web.HttpApplication.BeginProcessRequestNotification()
    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate()
    at System.Web.HttpRuntime.ProcessRequestNotification()
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper()
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification()
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion()
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper()
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification()

    If anyone has any information please help me here. 

    Thanks in Advance.

    Sourav


    Wednesday, May 23, 2018 8:38 AM

All replies

  • What you show is related to your code. Without that it is just guessing. 

    Probably you use a key at postback time while you have not saved that before sending. (ASP.Net is stateless)

    But probably you get easier help in these Microsoft forums. 

    http://forums.asp.net


    Success
    Cor

    Wednesday, May 23, 2018 8:44 AM
  • Thanks for your response.

    From the error stack is it possible to track which caused this?

    I have only the name of the MVC controller and corresponding action only using AppDynamics. But which line is causing this is still not clear.


    Wednesday, May 23, 2018 11:27 AM