Occasionally I have problems with applications which rely on unmanaged .dll's throwing exceptions which look like:
System.IO.FileLoadException: Could not load file or assembly 'AssemblyXXXX, Version=1.0.4099.27218, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
File name: 'AssemblyXXXX, Version=1.0.4099.27218, Culture=neutral, PublicKeyToken=null' ---> System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
The main problem is, that it does not say which dll could not be loaded, or which COM object is not registered.
Are there any tools that help track down this problem?
Fuslogvw shows you details of assembly loading errors. However, I'm guess that it's a COM
problem.
Try loading each of the COM dependencies dynamically (maybe in a different program, and maybe using their progid) using Type.GetTypeFromProgID and Activator.CreateInstance, and catching each error individually.
In the past, I've seen this error when there are different (older) versions of Office installed on user's machines.
Related
Since today I get the following new Error message:
System.IO.FileLoadException: Could not load file or assembly 'WebDriver, Version=2.53.1.0, Culture=neutral, PublicKeyToken=1c2bd1631853048f' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) ---> System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Everything worked fine until yesterday and now I lost 6 out of my 7 test VMs to this error.
I read every documentation I could find and tried to compare the non working VMs with the the non working version and could not find a difference.
Suspicious is the Version=2.53.1.0 as the current WebDriver DLL is 4.4.0. Where could the reference to this potential old DLL come from?
Is there a debug or logging option I could activate? A way to see which DLLs are loaded?
Needless to say that with only 1 out of 7 Testmachines we will not be able to meet the deadline.
Got it. It's the other way around. I must not use a new version. I must use an old 2.53 version.
The update must have slipped in because I can't remember updating them consciously.
For those who have similar problems: Extract the content of selenium-dotnet-strongnamed-2.53.1.zip into C:\Program Files (x86)\Common Files\microsoft shared\VSTT\Cross Browser Selenium Components\
Adjust destination directory if you have an unusual Windows installation.
I've got a project which has a Portable Class Library as "back-end" and a Universal Windows app for "front-end". Here is my repo at GitHub: huming2207/Rmiter
My target settings for the PCL library is "portable46-net451+win81", also the screenshot shows below:
When running the app it stuck at the beginning, showing a System.IO.FileLoadException from the backend PCL library, as below:
System.IO.FileLoadException: 'Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
...and here is the screenshot (in case if someone misunderstand my words):
But meanwhile I can see there was a "System.Runtime.dll" loaded when the app starts. But why it still throw exceptions later on?
I've searched and checked for quite a lot of similar issues and workarounds. But it seems that neither of them help at all.
This exception occurs when i try to load my app on my device (lumia 950).
An exception of type 'System.IO.FileLoadException' occurred in Template10Library.DLL but was not handled in user code
Additional information: Could not load file or assembly 'System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The environment: I'm using Template10 as a git submodule in my project instead of as a nuget package. I also have 2 other 'Class Library' projects and 1 'Windows Runtime Component' projects in my solution that my app depends on.
I'm a bit out of my depth here, I'm pretty new to app development and I have no clear understanding on the particulars of the windows build/deploy/runtime environment so I don't really know where to start.
I know you probably require more information in order to help me, so just ask and I'll try to get back to you.
Edit:
I added the following code in my app so that it ran before I got the exception above.
try
{
var assm = Assembly.Load(new AssemblyName("System.Threading"));
}
catch(Exception e)
{
System.Diagnostics.Debugger.Break();
}
By pausing the debugger at var assm ... I got the following information from the loaded assembly:
Fullname: "System.Threading, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
ImageRuntimeVersion: "v4.0.30319"
Location: "C:\windows\system32\SYSTEM.THREADING.NI.DLL"
So what does this mean? That my phone have older versions of system dll's? But why does my app require 4.0.10 when 4.0.0 should suffice?
EDIT 2:
I created a new blank app and a similar problem occured but this time with no library dependencies and this time I tried to use 'System.Net.Http.HttpClient' and I got the following exception:
An exception of type 'System.IO.FileLoadException' occurred in App1.exe but was not handled in user code
Additional information: Could not load file or assembly 'System.Net.Primitives, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I'm running OS build 10.0.10586.0 but I'm starting to consider that there is something wrong with my device.
Apparently my visual studio installation was messed up... so I did a complete reinstallation of the entire OS, and now it (and my apps) works properly.
Thank you Alan Yao for your input!
I am getting an error while running a .Net application.
The main problem which I feel is due to the Oracle.Data.Access.I made the project build to 32 bit as it had some problem of oracle exception
"Could not load file or assembly 'Oracle.DataAccess,
Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342'
or one of its dependencies. The system cannot find the file specified"
Making my project to 32 bit actually solved this Oracle problem, but then the following error is thrown:
((System.IO.FileNotFoundException)(the specified module could not be
found. (Exception from HRESULT: 0x8007007E)
I am actually trying to write to a file in the function from where the exception is being thrown.The file location is defined in app.config
Is this error due to 32 or 64 bit as my Windows 7 version is 64 bit and the project is built using 32 bit or something else
Please suggest a possible outcome of this error
The first error suggests the assembly (dll) Oracle.DataAccess is not found in your /BIN folder. If it is there please check the version, your application is expecting version: 2.111.7.20, you might be using another version.
Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified
The second error might be thrown because the Oracle.DataAcces it is 64-bit and your application is now running in 32-bit.
I am having trouble with security while migrating an application from .NET 3.5 to 4.0.
I have an application that starts successfully from a network share I've mapped to z: - Z:\MyApp\App.exe.
This application makes use of add-ins, and is sometimes asked to load assemblies from a seperate location on the Intranet - y:\MyLib\Lib.dll
In .NET 4.0, I get a System.Security.Security exception then this happens:
System.IO.FileLoadException: Could not load file or assembly 'XXXX' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
However, if I launch my application locally from C:\MyApp\App.exe, it is able to successfully load with Assembly.LoadFrom() the addin at y:\MyLib\Lib.dll.
What do I need to do to 'bless' the y:\MyLib location so that apps running from network shares are allowed to execute code from there?
Thanks,
Dave
I had a similar problem, I was able to solve it as is described in my question
Structuremap does not load registries when started from Network drive.
I hope this solves your problem also.