StrataFrame Forum

Could not load file or assembly '0 bytes loaded from system...Error

http://forum.strataframe.net/Topic25245.aspx

By Jeff Pagley - 11/18/2009

Hi SF Team,

I have a SF application currently running successfully on several Vista machines.  However, on one of the Vista machines I am getting the error below.  Can anyone tell me why I am getting this error only on this Vista pc and not the others?

Thanks,

Jeff

====================================================================================================================================================

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.

Exception (BadImageFormatException): Source="UJ.ExceptionManagement"; Target=null; Tag=null; FusionLog="";

Message = "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."

InnerException (BadImageFormatException): Message="Bad IL format."; Source=null; Target=null; Tag=null; StackTrace=null; FileName=null; FusionLog=null;

FileName = "0 bytes loaded from System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

Environment: ThreadIdentity="" DateTime=["2009-11-17 20:13:46.478"] ThreadName=null WindowsIdentity=["VistaServer\Prospect Helper"] ThreadId="1" DomainName="ProspectHelper.exe" OSVersion=["Microsoft Windows NT 6.0.6001 Service Pack 1"]

MachineName="VISTASERVER" UserName=["Prospect Helper"]

Frame0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)

at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)

at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)

at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)

at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)

at DevExpress.XtraReports.Native.Compiler.CompileAssemblyFromSource(CompilerParameters parameters, String source)

at DevExpress.XtraReports.Native.Compiler.GetCompiledAssembly()

at DevExpress.XtraReports.Native.ReportCompiler.Compile(Stream stream, IServiceProvider serviceProvider, Boolean includeAppDomainReferences)

at DevExpress.XtraReports.UI.XtraReport.LoadLayoutInternal(Stream stream, XtraReport& source, Boolean includeAppDomainReferences, Boolean forceDataSource)

at DevExpress.XtraReports.UI.XtraReport.LoadLayout(Stream stream)

at DevExpress.XtraReports.UI.XtraReport.LoadLayout(String fileName)

at ProspectHelper.ReportsDialog.DisplayDevExpressReport()

Implementer (ReportsDialog): components=System.ComponentModel.Container; ReportsBO1={ [ProspectHelper.ReportsBO]};

BusinessBindingSource1 (BusinessBindingSource): Count=4; #0=ProspectHelper.ReportsBO; #1=ProspectHelper.ReportsBO; #2=ProspectHelper.ReportsBO; #3=ProspectHelper.ReportsBO;

scrollPosition (Point): x=0; y=0;

PanelControl1 (PanelControl):

GroupControl1 (GroupControl): LabelControl3=DevExpress.XtraEditors.LabelControl; LabelControl2=DevExpress.XtraEditors.LabelControl; dtpToDate=DevExpress.XtraEditors.DateEdit; dtpFromDate=DevExpress.XtraEditors.DateEdit;

LabelControl1=DevExpress.XtraEditors.LabelControl;

cboCampaigns = MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit

GroupControl2 (GroupControl): btnOpenReportDesigner=DevExpress.XtraEditors.SimpleButton; btnPreviewXtraReport=DevExpress.XtraEditors.SimpleButton; btnPreview=DevExpress.XtraEditors.SimpleButton; listboxReports=DevExpress.XtraEditors.ListBoxControl;

Remaining Stack Trace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

at ProspectHelper.ReportsDialog.btnPreviewXtraReport_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)

at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)

at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

By Greg McGuffey - 11/18/2009

You've probably tried this, but it seems like the file is corrupt (or maybe the HD is dying), so did you try a reinstall?
By Jeff Pagley - 11/18/2009

Yes I did try a reinstall, but I got the same error.
By Dustin Taylor - 11/19/2009

I'm assuming ProspectHelper.exe is your app? Have you tried ensuring the environment is the same as the other machines? DEP, Firewalls, etc. are set to match?

I've also seen active antivirus mess with those on-the-file assembly compiles, which could be part of the problem. In our own app, certain active anti-viruses will delete the run-time complied script .DLLs that PerpetuumSoft generates when printing reports. If XtraReports does something similar, it could be a similar issue. 

Try stripping off everything along those lines: AntiVirus, Firewall, Spyware, DEP, UAC, basically anything that will try and interfere with your environment "for your own protection" and see if you have better results. 

Past that, I would agree with Greg that it sounds like a corrupted file hanging out there. The stack trace makes it sound like it is trying to pull an image out of a dynamically generated assembly, but if I'm misreading that and it is actually trying to pull out of a static assembly, you'll need to figure out which one and identify the bad copy.

By Dustin Taylor - 11/19/2009

Where I said "on-the-file assembly compiles" I meant "on-the-fly assembly compiles" Smile
By Edhy Rijo - 11/19/2009

Hi Jeff,



Is this Vista OS a 64bits on AMD processor?



If so, make sure your compiled project Target CPU value is setup as "x86" instead of "AnyCPU" which is the VS default unless your application directly supports 64bits OS.



You will find this option in your Project's Compile option -> Advance Compile Options.
By Jeff Pagley - 11/19/2009

Hi Dustin,

The error does occur when I am trying to preview an XtraReport.  I will look into checking all of those issues you suggested.

Thanks,

Jeff