Error : Value cannot be null ,Parameter name:Key

Hi,

Follwoing is the error which is coming randomly on running the application ..

Error : Value cannot be null ,Parameter name:Key

The project is running properly on one machine but when copied to new machine and later run from new location above error is coming.

This error comes very randomly for intial run the application is running properly but after some time this error comes up.

We tried changing "AllowNull" property to "true" of value property eventhough the above mentioned error is coming.

If project is created from scratch on one's machine then this problem is not coming so frequentlyyy but when copied to new machine this eror is coming frequently.

please can anyone suggest solution to this problem.

or any direction for above error.

Thanx in advance.

Regards

Kiran Kirdat



Answer this question

Error : Value cannot be null ,Parameter name:Key

  • Penicillin

    Thanks for posting the callstack. This is consistent with a change in the domain model format, specifically to the domain class CompanyName.ProjectName.DSLToolBox.DomainModel.ExampleModel. Did you rename or remove this class at some point The easiest way to fix this would be to just recreate the file using your current model, but if you've renamed the ExampleModel class, you should also be able to open the serialized file in the XML editor, and replace "ExampleModel" with the new name.

    Thanks,

    Grayson


  • Gary_MN

    See my post here:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=328945&SiteID=1

    If this doesn't solve your problem, can you please post a callstack for the error To obtain this, break on System.ArgumentNullException (Debug->Exceptions, check the box next ot that exception in the tree viewv under "Common Language Runtime Exceptions"), and run your DSL with F5 (you may need to turn off "Just My Code" feature in Tools->Options->Debugger->General).

    Thanks,

    Grayson


  • Ales Ricar

    Hi Jonas,

    I have tried to close everything in the project and then close and restarted the VS, but it still having the same error.

    Any ideas

    Cheers,

    Jack

  • Jerrie Pelser

    Hi,

    The entire callstack for the error which appears on my machine is as follows:

    ************************************************************************************************

    mscorlib.dll!System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument argument) + 0x2a bytes 
      mscorlib.dll!System.Collections.Generic.Dictionary<System.Type,Microsoft.VisualStudio.Modeling.MetaClassInfo>.FindEntry(System.Type key = null) + 0x14a bytes 
      mscorlib.dll!System.Collections.Generic.Dictionary<System.Type,Microsoft.VisualStudio.Modeling.MetaClassInfo>.TryGetValue(System.Type key, out Microsoft.VisualStudio.Modeling.MetaClassInfo value = null) + 0xf bytes 
      Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.MetaDataDirectory.FindMetaClass(System.Type type = null) + 0x2d bytes 
      Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.GetType(Microsoft.VisualStudio.Modeling.Partition partition = {Microsoft.VisualStudio.Modeling.Partition}, string typeName = "CompanyName.ProjectName.DSLToolBox.DomainModel.ExampleModel", string namespace = null, Microsoft.VisualStudio.Modeling.SubStore[] subStores = {Dimensions:Devil}) + 0x19f bytes 
      Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.DeserializeElements(Microsoft.VisualStudio.Modeling.Partition partition = {Microsoft.VisualStudio.Modeling.Partition}, System.Collections.Hashtable mapSettingIdToElement = Count = 0, ref Microsoft.VisualStudio.Modeling.SubStore[] subStores = {Dimensions:Devil}, System.Xml.XmlReader xmlReader = {Element, Name="om:Property"}, int majorVersion = 1, int minorVersion = 1, bool checkFileVersion = true, Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized deserialized = {Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized}) + 0xa3f bytes 
      Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.DeserializePartition(Microsoft.VisualStudio.Modeling.Partition partition = {Microsoft.VisualStudio.Modeling.Partition}, System.IO.Stream stream = {System.IO.FileStream}, int majorVersion = 1, int minorVersion = 1, Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.UpgradeFileFormat upgradeFileFormat = {Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.UpgradeFileFormat}, Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized deserialized = {Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized}) + 0x15f bytes 
      Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.DeserializeStore(Microsoft.VisualStudio.Modeling.Store store = {Microsoft.VisualStudio.Modeling.Store}, System.IO.Stream stream = {System.IO.FileStream}, int majorVersion = 1, int minorVersion = 1, Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.UpgradeFileFormat upgradeFileFormat = {Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.UpgradeFileFormat}, Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized deserialized = {Microsoft.VisualStudio.Modeling.Diagnostics.XmlSerialization.Deserialized}) + 0x91 bytes 
      Microsoft.VisualStudio.Modeling.Sdk.Utilities.dll!Microsoft.VisualStudio.Modeling.Utilities.ImsDocData.ImsLoad(Microsoft.VisualStudio.Modeling.Store store = {Microsoft.VisualStudio.Modeling.Store}, System.IO.Stream stream = {System.IO.FileStream}) + 0x9c bytes 
      Microsoft.VisualStudio.Modeling.Sdk.Utilities.dll!Microsoft.VisualStudio.Modeling.Utilities.ImsDocData.Load(string fileName = "D:\\DSLToolsProject\\2903\\DSLToolBox\\DSLToolBox\\Debugging\\Test.biz", bool isReload = false) + 0x95 bytes 
      Microsoft.VisualStudio.Modeling.Sdk.Shell.dll!Microsoft.VisualStudio.EnterpriseTools.Shell.DocData.LoadDocData(string fileName = "D:\\DSLToolsProject\\2903\\DSLToolBox\\DSLToolBox\\Debugging\\Test.biz", bool isReload = false) + 0x2f bytes 
      Microsoft.VisualStudio.Modeling.Sdk.Shell.dll!Microsoft.VisualStudio.EnterpriseTools.Shell.ModelingDocData.LoadDocData(string fileName = "D:\\DSLToolsProject\\2903\\DSLToolBox\\DSLToolBox\\Debugging\\Test.biz", bool isReload = false) + 0x2ac bytes 
      Microsoft.VisualStudio.Modeling.Sdk.Shell.dll!Microsoft.VisualStudio.EnterpriseTools.Shell.DocData.LoadDocData(string fileName = "D:\\DSLToolsProject\\2903\\DSLToolBox\\DSLToolBox\\Debugging\\Test.biz") + 0x86 bytes 
      [Native to Managed Transition] 

    ********************************************************************************************************************


  • Laurence Starks MSFT

    I am also getting similar error.

    Can someone please help

    Thanks in advance.


  • Slicksim

    I've had that error when I hade an open xsd-file in my solution. Closed it and the errormessage disappeared. No probs with the xsd.

    Open your project, look for open xsd-files. Close them before you save + close your project.



  • IMclgonzo

    Hi Grayson,

    I am using Team foundation server. Recently, I come across a weird problem. When I tried to check in a project, the Source control is giving me an weird error , saying that Error : Value cannot be null ,Parameter name:Key.

    Do you have any idea why this is happening

  • spidey_witnesssss

    My error is on my HP IMAGE ZONE PLUS. When I try to access I get " The program has encountered and unexpected error: Parameter cannot be null. Parameter name: serialization Stream"

    It would great if you could help me resolve it. Thank you.

    Veronica


  • Error : Value cannot be null ,Parameter name:Key