Gallio 3.4 is not loading assemblies of .NET version 4.5 - c#

My assemblies are in .NET framework version 4.5 and I am using gallio 3.4 but whenever I am running, gallio.echo.exe with dll is throwing exception
System.BadImage Format Exception : could not load file
An attempt was made to load a program with an incorrect format.
FileName: Winshuttle.SapTransaction.Recorder, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null FusionLog: 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].
HResult: -2147024885
Please suggest whats the issue. Is there any other gallio version to run 4.5 assemblies

Related

BadImageFormatException error throws while executing a console application

I'm getting below error while executing a C# console application. It's seems to me as machine specific issue. It's working on my windows 8 machine with .Net framework 4.5. But it's not working on my friend's PC with the same configuration. I have no idea how to solve this.
I tried with changing Visual studio application properties - Build properties to "X86" and "Any CPU". But it's not working.
A little help please.
System.BadImageFormatException: Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f
5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.ChannelFactory..ctor()
at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at ApiKeyVerifier.Program.Main(String[] args) in D:\Projects\ApiKeyVerifier\Program.cs:line 17
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].

Could not load file or assembly System, Version=2.0.5.0 in .NET 4 MVC 4 application

Been searching for ages, can't find anything helpful. Here is the exception I'm getting:
Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Stack Trace:
[FileLoadException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
StructureMap.Graph.PluginGraph..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Graph\PluginGraph.cs:41
StructureMap.PluginGraphBuilder..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\PluginGraphBuilder.cs:22
StructureMap.InitializationExpression..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\InitializationExpression.cs:22
StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\ObjectFactory.cs:47
...
This applications works fine on the test server but is throwing this exception on the production server. As you can see, the StructureMap code is what is causing the exception.
I had to convert this app to .NET 4 from 4.5 because 4.5 wasn't installed on the production server. After the conversion, the app still works fine on my local machine and the test server.
I have already set the Copy Local to True for the System assembly, but since the referenced version is 4.0.0.0 and not 2.0.5.0, I this made no difference.
Let me know if any more info is needed. Any help you may be able to provide is appreciated.
Make sure your .NET framework is patched. Microsoft released patches to .NET to allow Portable Class Libraries to properly find the appropriate runtime (KB2468871). If you are seeing the above exception (or something like it), it means you're missing the latest .NET framework patches.
Edit the web.config file to remove the reference, which is not required for normal operation:
1 - Open the web.config file in the root of your site
2 - Find the following line and comment it out():xxxxx-is your assembly name.
<add assembly="xxxxx", Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
3 - Save and close the web.config file and try again
I found that it was the "await" and "async" that where giving me trouble.
I had Windows XP SP3 with only .NET 4.0, but had to update it to .NET 4.0.3 using KB2600211 - this wasn't updated automatically through Windows Update when .NET 4.0.3 came out because the computer is off-grid.
This is the link to the update:
https://www.microsoft.com/en-us/download/details.aspx?id=29053
I just want to share another solution from here that solved the problem on my development machine: installing Silverlight 5 SDK (only 11.2MB at the time of writing this post) was enough to make everything working.
Install Microsoft® Silverlight® 5 SDK from the following link. It resolves and works fine for me.
SDK download
Starting from a machine configuration that only had VS2017 and Silverlight 5 SDK on it, I installed VS2015 on top of that. This is when I started getting the System.Core and System.Windows problems.
When I uninstalled VS2015 and re-installed Silverlight 5 SDK, these problems went away.

System.IO.FileLoadException: Could not load file or assembly

While trying to execute my web application, it throws the following error. It says Matrix.Data.dll could not load. I tried to rebuild the assembly and reference it again. But no use. Also, it is showing a warning 'Assembly binding logging is turned OFF' and what will be the performance penalty associated with assembly bind failure logging...?
Error in detail:
System.IO.FileLoadException: Could not load file or assembly 'Matrix.Data, Version=5.0.3.16,
Culture=neutral, PublicKeyToken=ed19106b2f44b5a8' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
File name: 'Matrix.Data, Version=5.0.3.16, Culture=neutral,
PublicKeyToken=ed19106b2f44b5a8'
at Matrix.Administration._Administration.DoRequest(Boolean& plReplacePlaceholders)
at Matrix.AppServerHTTPHandler.doRequestDefault()
in D:\FX\AppServer\Appserver.vb:line 443
at AppServer.AppServerHTTPHandler.doRequest(Kernel pKernel)
in D:\FX\AppServer\Appserver.vb:line 373
at AppServer.AppServerHTTPHandler.processRequest(HttpContext context)
in D:\FX\AppServer\Appserver.vb:line 107
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].
Your Accessibility.dll is most likely corrupted. You will not be able to delete the file, even as Administrator.
You must go into the security settings and change the owner from TrustedInstaller to a different user and give yourself permissions on the file. Once done, get an Accessibility.dll from a working computer and replace your corrupted version.
Best I can guess, an installer from Microsoft corrupted the DLL as no user has permission to edit/delete/replace files owned by TrustedInstaller.

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

log4net not logging and throwing error

I have been using log4Net to write in a text file when there is any exception in my web service, this was working but today it started to throw error.
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.TypeInitializationException: The type
initializer for.. threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly
'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
File name: 'log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=b32731d11ce58905'
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].
If you have any inputs on this stack info, pls. share it.
Did you change the code, or did this just start happening?
I've seen this error occur when the target processor architecture was mismatched. Did you change that by any chance?
If this isn't the case, and you have Windows SDK installed, you can use the Fusion Log Viewer to view assembly binding logs. The utility should be installed on your machine.

Categories

Resources