.net - Crash Instantiating System.Xml.Serialization.XmlSerializer in C# -


we're seeing crash when instantiating instance of system.xml.serialization.xmlserializer class in c# library. crash occurs in constructor, when tries add duplicate key dictionary. i've included stack trace below.

this crash occurring on 1 machine, , repairing our installation of .net 3.5 didn't help. has else seen similar issues?

system.argumentexception unhandled   message="item has been added. key in dictionary: 'mainbuild'  key being added: 'mainbuild'"   source="mscorlib"   stacktrace:        @ system.collections.hashtable.insert(object key, object nvalue, boolean add)        @ system.collections.hashtable.add(object key, object value)        @ system.collections.specialized.stringdictionary.add(string key, string value)        @ system.codedom.compiler.executor.execwaitwithcaptureunimpersonated(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline)        @ system.codedom.compiler.executor.execwaitwithcapture(safeusertokenhandle usertoken, string cmd, string currentdir, tempfilecollection tempfiles, string& outputname, string& errorname, string truecmdline)        @ microsoft.csharp.csharpcodegenerator.compile(compilerparameters options, string compilerdirectory, string compilerexe, string arguments, string& outputfile, int32& nativereturnvalue, string trueargs)        @ microsoft.csharp.csharpcodegenerator.fromfilebatch(compilerparameters options, string[] filenames)        @ microsoft.csharp.csharpcodegenerator.fromsourcebatch(compilerparameters options, string[] sources)        @ microsoft.csharp.csharpcodegenerator.system.codedom.compiler.icodecompiler.compileassemblyfromsourcebatch(compilerparameters options, string[] sources)        @ system.codedom.compiler.codedomprovider.compileassemblyfromsource(compilerparameters options, string[] sources)        @ system.xml.serialization.compiler.compile(assembly parent, string ns, xmlserializercompilerparameters xmlparameters, evidence evidence)        @ system.xml.serialization.tempassembly.generateassembly(xmlmapping[] xmlmappings, type[] types, string defaultnamespace, evidence evidence, xmlserializercompilerparameters parameters, assembly assembly, hashtable assemblies)        @ system.xml.serialization.tempassembly..ctor(xmlmapping[] xmlmappings, type[] types, string defaultnamespace, string location, evidence evidence)        @ system.xml.serialization.xmlserializer.generatetempassembly(xmlmapping xmlmapping, type type, string defaultnamespace)        @ system.xml.serialization.xmlserializer..ctor(type type, string defaultnamespace)        @ system.xml.serialization.xmlserializer..ctor(type type)        @ ourtools.tools.common.xml.dataaccess`1.deserializefromxml(string strfilepath) in c:\automatedbuild\projects\1.0\ourtools.tools.common\ourtools.tools.common\xml\dataacess.cs:line 100        @ ourtools.tools.common.projectfilemanager.getprojectinfomodel() in c:\automatedbuild\projects\1.0\ourtools.tools.common\ourtools.tools.common\projectfilemanager.cs:line 252        @ ourtools.tools.common.projectfilemanager.getavailablecultures() in c:\automatedbuild\projects\1.0\ourtools.tools.common\ourtools.tools.common\projectfilemanager.cs:line 299        @ ourapplib.generatoroptions.defaultcultures() in c:\automatedbuild\projects\1.0\ourapp\ourapplib\generatoroptions.cs:line 192        @ ourapplib.generatoroptions.readculturesfromargs(list`1 arglist, string& errormsg) in c:\automatedbuild\projects\1.0\ourapp\ourapplib\generatoroptions.cs:line 358        @ ourapplib.generatoroptions.readfromargs(string[] args, string& errormsg) in c:\automatedbuild\projects\1.0\ourapp\ourapplib\generatoroptions.cs:line 261        @ ourapp.program.main(string[] args) in c:\automatedbuild\projects\1.0\ourapp\ourapp\program.cs:line 76`print("code sample");` 

found link, explains issue: http://social.msdn.microsoft.com/forums/en-us/asmxandxml/thread/4476f044-bab9-492d-bb94-4e0960bd2d26

a quick summary: when serializing, object makes dictionary out of environment variables, appears run tolower() on entries. so, if have 2 environment variables same except casing, you'll crash.

this going problem when running inside system cygwin enforces case sensitivity variables. in our case, we're using make.

there couple solutions, revolve around making sure environment doesn't have duplicated variables when c# app runs.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -