Could not load file or assembly '0 bytes loaded from System, Version=2.0.0.0, Culture=neutral, Publi

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have a C#.Net winforms application. When I tried to load the application, 90% of the application window is getting loaded but finally, I get the following error:
"Could not load file or assembly 0 bytes loaded from System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 or one of its dependencies. An attempt was made to load a program with an incorrect format".
I tried reinstalling .net framework in the machine. But still the error persists.
I tried debugging and found out that the problem occurs while trying to create an XmlSerializer object.
<span style="font-size:x-small; color:#008080 <span style="font-size:x-small; color:#008080
XmlSerializer

<span style="font-size:xx-small <span style="font-size:xx-small <span style="font-size:x-small serializer =
<span style="font-size:x-small; color:#0000ff new<span style="font-size:x-small
<span style="font-size:x-small; color:#008080 XmlSerializer<span style="font-size:x-small (<span style="font-size:x-small; color:#0000ff typeof<span style="font-size:x-small (<span style="font-size:x-small; color:#008080 Column<span style="font-size:x-small ));
<span style="font-size:x-small <span style="font-size:xx-small I created a test application with XmlSerialization and the error occurs for this application as well.
This is the error details that I get now.
Exception : Could not load file or assembly 0 bytes loaded from System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 or one of its dependencies. An attempt was made to load a program with an incorrect format.
Inner Exception : Bad IL format.
Stack Trace : at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)<br/>
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)<br/>
at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)<br/>
at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)<br/>
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)<br/>
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)<br/>
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)<br/>
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)<br/>
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)<br/>
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)<br/>
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)<br/>
at System.Xml.Serialization.XmlSerializer..ctor(Type type)<br/>
at CheckXmlApplication.Form1.GetColumnSelection() in D:AssetsCheckXmlApplicationCheckXmlApplicationForm1.cs:line 122<br/>
at CheckXmlApplication.Form1.btnCheckXml_Click(Object sender, EventArgs e) in D:AssetsCheckXmlApplicationCheckXmlApplicationForm1.cs:line 147
Source : mscorlib
Operating system of the machine : WinXP 32bit.
Thanks & Regards,
Anoop.


View the full article
 
Back
Top