There is an exception in Crystal Reports on client machine - c#

I got the error mentioned as below on client machine. For some systems it is working well but for some I get the error mentioned as below:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.BadImageFormatException:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies.
An attempt was made to load a program with an incorrect format.

It could be useful to someone: if you have the option to do it, go to IIS and set the Application Pool to 32 bit applications only.
That made the trick for me.
(Of course, your application could be made to run only on 64 bit. In that case, I think the installing of the 64 bit redistributable of CrystalReports should solve the issue)

Related

System.BadImageFormatException' occurred in your application(E.g. MyApplication.exe)

I am using Windows Application to communicate with Oracle 11g database to fetch some data. Oracle database was installed on the X64 bit system.
My Application builds successfully on my system (the x86 bit) with x64 bit dlls of Oracle. But when I run application below mentioned errors occurred.
An unhandled exception of type 'System.BadImageFormatException' occurred in your application(E.g. MyApplication.exe)
Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I had tried different ways to resolve this issue but still unable to found a solution for same. Please help me to resolve this issue.
You are trying to load a 64bit DLL from a 32 bit process or vice versa. Make sure the DLLs you want to load have the same bitness as your process.

Jenkins OutOfMemory Exception with different routing

i'm having a big problem when try to build on jenkins
This exception is due to a routing convention
When using this
[HttpPost, Route(#"{appName:regex(^[A-Za-z0-9, ]+$)}/{moduleName:regex(^[A-Za-z0-9, ]+$)?}")]
although on my local it works, when try to deploy on jenkins it fails to build the project
either i get this
Unhandled Exception: OutOfMemoryException.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9):
error MSB6006: "csc.exe" exited with code 255.
[D:\Jenkins\jobs\ReleaseNotes-Test\workspace\ECM.ReleaseNotes.WebApi.csproj]
Done Building Project
"D:\Jenkins\jobs\ReleaseNotes-Test\workspace\ECM.ReleaseNotes.WebApi.csproj"
(PublishToFileSystem target(s)) -- FAILED.
Build FAILED.
or
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'System.Xml, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
paging file is too small for this operation to complete. (Exception
from HRESULT: 0x800705AF)
Restarting server is one way to fix it but if it persists this could be due to Low amount of memory allocated to your jenkins... In that case use the following link to increase the amount of memory given to Jenkins.
https://wiki.jenkins-ci.org/display/JENKINS/Builds+failing+with+OutOfMemoryErrors
it appeared that the problem was the server. After restarting i was able to make the deploy.

How to execute with a copied dll from another machine - c#

I am trying to provide a colleague with a dll that is from my build so she can execute with the changes i have made. Unfortunately she gets the following error
The system was unable to launch the requested screen. --->
Unable to display screen.
---> System.IO.FileLoadException: Could not load file or assembly 'file:///name.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515) --->
System.NotSupportedException: An attempt was made to load an assembly
from a network location which would have caused the assembly to be
sandboxed in previous versions of the .NET Framework. This release of
the .NET Framework does not enable CAS policy by default, so this load
may be dangerous. If this load is not intended to sandbox the
assembly, please enable the loadFromRemoteSources switch
Now if she were trying to run it in visual studio i could set the loadFromRemoteSources switch - however this dll is replacing a dll in an install version on a vagrant box. How can i enable the dll to run in this scenario?
Thanks

Could not load file or assembly in Visual Studio 2010

My project uses another lib project as reference.
I get this error when trying to run a project in "Relase" Mode, In "Debug" Mode it works fine.
It says that it cannot load the lib project because :
"An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'UserManagementProviders,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
An attempt was made to load a program with an incorrect format."
BadImageFormatException means 32/64 bit mismatch. Check your project configurations. The x86/x64/Any CPU settings must be messed up among Debug and Release configurations.
I think this is related to the difference in 64bit and 32bit DLL builds and processes.
Try compiling to 32bit by changing project properties/Build/Platform Target.

UNC Path and Unhandled Exception: System.BadImageFormatException in C#

I compiled the whole project with x86 platform target. It is working fine when I copy .exe and the reference dlls on to the server and run .exe from server cmd window.
Our requirement is to copy the exe and dlls onto some network path and execute the exe on the server using UNC path. When I execute using UNC path, I am getting the error:
Unhandled Exception: System.BadImageFormatException: Could not load
file or assembly 'XXXX, Version=3.0.10.19399, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. An attempt was made
to load a program with an incorrect format.
File name: 'XXXX, Version=3.0.10.19399, Culture=neutral, PublicKeyToken=null'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Can someone help?
I'm just guessing now, but I would probably blame the path itself - it's most likely "untrusted", reason unknown. Enable Assembly Bind Logging (tip: google :) ) to figure out what's happening

Categories

Resources