We are having an issue related to starting a few in house developed .NET applications on Windows 10 Version 1607 machines. Sometimes starting an application doesn't succeed. This is because loading a dependent .NET assembly fails. The error message is:
System.IO.FileLoadException: Could not load file or assembly
'[assemblyname], Version=[version], Culture=neutral,
PublicKeyToken=[publickeytoken]' or one of its dependencies. The data
area passed to a system call is too small. (Exception from HRESULT:
0x8007007A)
The issue happens about 10% of the application startups in different .NET applications. It happens with 32-bit as well as 64-bit applications. During all the startups also many other applications start that start up OK. I wonder why we get the 0x8007007a error? Maybe it is collateral due to a heap corruption that happened before?
You can see related logging from FUSLOGVW below. The filepaths and assembly names are anonymised. The assembly that is attempted to be loaded has quite a long name (59 characters without the .dll postfix). As a test, we changed the name of the assembly to a shorter name. Unfortunately the issue remained. Adding a probing path in the exe.config also did not fix the issue.
Furthermore, there seems to be code of an older version of the Microsoft Assembly Resolver available at Github: https://github.com/fixdpt/shared-source-cli-2.0. I suspect there is something wrong in the ConstructCodeBaseList in adlmgr.cpp. But I can't figure out what triggers the issue.
*** Assembly Binder Log Entry (2020/01/30 # 13:48) ***
The operation failed.
Bind result: hr = 0x8007007a. The data area passed to a system call is too small.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/XXX/XXX/XX.X.X.X/XXX/XXXXXXXXXXXXXX/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ApplicationWeWantToStart.exe
Calling assembly : ApplicationWeWantToStart, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
LOG: GAC Lookup was unsuccessful.
ERR: Error occurred constructing the probing codebase list.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x8007007a).
Any change your startup issue may be related to this Microsoft Support Link
Related
I have a .NET 4.5 application that works and runs with no issues in most environments; however, one area of the application throws a runtime assembly reference error on some client machines:
Could not load file or assembly 'System.Xml.Linq, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The file cannot be accessed by the system. (Exception from HRESULT: 0x80070780)
I ran the fusion logs and interestingly, this assembly seems to be loaded twice, once for version 4.0.0.0 and then for version 3.5.0.0 when Newtonsoft.Json version 6.0.8 is loaded. The first load works and the second is where the binding error comes from.
Here is the Fusion log for the successful 4.0.0.0 bind:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 # 12:40:06 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
</pre></html>
And here is the unsuccessful 3.5.0.0 bind:
<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry (1/16/2017 # 12:41:12 PM) ***
The operation failed.
Bind result: hr = 0x80070780. The file cannot be accessed by the system.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/<user>/AppData/Local/Apps/MyApplicationPath/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<user>\AppData\Local\Apps\MyApplicationPath\MyApplication.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Version redirect found in framework config: 3.5.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll.
LOG: Assembly is loaded in default load context.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070780).
</pre></html>
What really makes no sense to me is that it is loading the assembly from the same exact location, and it just is not working the second time around. I thought this was perhaps due to a lock of some sorts on the GAC assembly, but after checking the Fusion log on a working environment, the log file is the same, just without the final error line, so that is not it.
What is also interesting is that this problem appears to only be happening on Windows 10 machines, but not all Windows 10 machines. It also appears to not be limited to upgrades or fresh Win10 installs; it happens on both.
I have tried numerous things to fix this problem, including:
.NET repair
fully removing and re-installing .NET
clearing temporary ASP.NET files
adding assembly binding redirects/probing to the application config files to manually point to the file referenced the application's bin folder or the root folder (tried this for version 3.5, 4.0, and 4.5 of the referenced assembly.
Using the Windows 10 Repair functionality to reinstall the OS (and keep the files)
Ensuring the required assembly is located in the GAC (in the new GAC location)
Republishing the application using the latest version of Newtonsoft.Json.
creating a basic test app that references Newtonsoft.Json and the same System.Xml.Linq assembly (that works on the bad machines)
I appear to be running out of options, and unfortunately, I cannot get a more specified error than "Unrecoverable error," so I am not sure where else to look. Any help is greatly appreciated!
I have a C# program that links to a (large) third-party library and builds successfully with it. All necessary references between my program and the library are included, and the program starts correctly.
Upon loading the .NET managed DLL for the aforementioned library, I get a System.IO.FileNotFoundException that says that the library or one of its dependencies could not be loaded ("The specified module could not be found.").
Since the relevant DLL is present in the Release directory, I went through the fusion event logs and found only binding failures for a bunch of nonexistent <PROJECT>.resource.<DLL|EXE> files under a nonexistent Release\en directory. This doesn't make much sense to me at all, since the project's only resource (a single icon) is internalized.
The logs look like this, with some information redacted:
*** Assembly Binder Log Entry (7/11/2016 # 10:08:49 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\USER\Desktop\PROJECT\bin\x86\Release\PROJECT.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = PROJECT.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = PROJECT.vshost.exe
Calling assembly : PROJECT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\USER\Desktop\PROJECT\bin\x86\Release\PROJECT.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources/PROJECT.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources.EXE.
LOG: Attempting download of new URL file:///C:/Users/USER/Desktop/PROJECT/bin/x86/Release/en/PROJECT.resources/PROJECT.resources.EXE.
LOG: All probing URLs attempted and failed.
Update: This is what Process Monitor shows when loading the DLL:
The first three loads are the relevant DLL, and the following ones are (ostensibly) its dependencies, all from the standard VS C++ redistributable.
Update 2: Dependency Walker shows the same DLLs as missing, although this doesn't seem to manifest at load time:
Schema specified is not valid. Errors: (0,0) : error 0004: Could not
load file or assembly 'JIMSDAL, Version=6.0.5126.47, Culture=neutral,
PublicKeyToken=9054b539c49e6e2e' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Why I get this exception, I checked every dependent project of JIMSDAL and they are referencing the correct updated version 6.0.1.0.
I also checked with fuslogvw.exe and its not helping. It says
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable X:\yyyyy\Build\Debug\JIMS.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = JIMSDAL, Version=6.0.5126.47, Culture=neutral, PublicKeyToken=9054b539c49e6e2e
(Fully-specified)
LOG: Appbase = file:///X:/yyyyy/Build/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
Calling assembly : EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: X:\yyyyy\Build\Debug\JIMS.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: JIMSDAL, Version=6.0.5126.47, Culture=neutral, PublicKeyToken=9054b539c49e6e2e
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///X:/yyyyy/Build/Debug/JIMSDAL.DLL.
LOG: Assembly download was successful. Attempting setup of file: X:\yyyyy\Build\Debug\JIMSDAL.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: JIMSDAL, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9054b539c49e6e2e
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
There is no config file with this version too. I even removed the reference of this project and re added. But nothing works. Where am I going wrong?
That's not much to go by but the FSLogVw output shows the calling assembly to be EF. Are you using and edmx? If so, you may want to open it in XML view (not design view) and see if there are references to your assembly in there. You mentioned you've already checked the .config file, so that rules that out.
You are referencing JIMSDAL, Version=6.0.5126.47, but the calling assembly found JIMSDAL, Version=6.0.0.0. I've had this happen in the past when mixing project references with references to a compiled assembly, but there are other ways it can happen. Look for multiple references to JIMSDAL, and make sure they are all pointing to the same thing.
This question (https://stackoverflow.com/questions/5600904/net-dll-dependency-of-same-file) describes a similar problem, you might want to take a look.
And here's another question with some helpful suggestions: Project References DLL version hell
I'm having this weird revision mismatch error. All my NUnit test projects used to work with NUnit 2.5.7, but now that I switched them to using NUnit v2.5.10, I keep on getting the following error:
FileLoadException: Could not load file or assembly 'nunit.framework, version 2.5.7...
Note: I cleaned up, rebuilt, double checked the references, no problem there.
Using the Assembly Binder Log Viewer (see below), it seems to me that the trigger of this error is the Spring.Testing.NUnit.dll... which seems weird given that the Spring.Testing.Nunit 1.3.2 Nuget page says in its Dependency List: NUnit (≥ 2.5.7)
Any idea what I'm missing here?
Thanks in advance,
TB.
Assembly Binder Log Entry (02.07.2012 # 16:06:35)
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under
executable
F:\robin\4-Development\Workspace\3rdParty\NUnit\2.5.10\nunit-agent.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: User = Mth\tbourguignon LOG: DisplayName = nunit.framework, Version=2.5.7.10213,
Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 (Fully-specified)
LOG: Appbase = file:///F:/robin/4-Development/Workspace/Application
LOG: Initial PrivatePath =
Rh.Robin.Common.Tests\bin\Debug;Rh.Robin.Service.Test\bin\Debug;Rh.Robin.Domain.Unit.Test\bin\Debug;Rh.Robin.Service.Unit.Test\bin\Debug;Rh.Robin.Web.UI.MVC.Unit.Test\bin\Debug
LOG: Dynamic Base = NULL LOG: Cache Base =
C:\Users\tbourguignon.Mth\AppData\Local\Temp\nunit20\ShadowCopyCache\4980_634768419945070499
LOG: AppName = Tests_29030132 Calling assembly : Spring.Testing.NUnit,
Version=1.3.2.40943, Culture=neutral, PublicKeyToken=65e474d141e25e07.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file: LOG:
Using machine configuration file from
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: nunit.framework, Version=2.5.7.10213,
Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 LOG: GAC Lookup was
unsuccessful. LOG: Attempting download of new URL
file:///F:/robin/4-Development/Workspace/Application/nunit.framework.DLL.
LOG: Attempting download of new URL
file:///F:/robin/4-Development/Workspace/Application/nunit.framework/nunit.framework.DLL.
LOG: Attempting download of new URL
file:///F:/robin/4-Development/Workspace/Application/Rh.Robin.Common.Tests/bin/Debug/nunit.framework.DLL.
LOG: Assembly download was successful. Attempting setup of file:
F:\robin\4-Development\Workspace\Application\Rh.Robin.Common.Tests\bin\Debug\nunit.framework.dll
LOG: Entering download cache setup phase. LOG: Assembly Name is:
nunit.framework, Version=2.5.10.11092, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77 WRN: Comparing the assembly name
resulted in the mismatch: Revision Number ERR: The assembly reference
did not match the assembly definition found. ERR: Setup failed with hr
= 0x80131040. ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Did you gain anything from referencing a newer dot-version of NUnit? If not, the easiest thing you could do is go back and reference the older version of NUnit assemblies matching the version Spring is referencing in your code.
The other option is to modify your (Spring) application's configuration to use binding redirects to pick up the newer version of NUnit assemblies.
It makes me wonder if Spring's reference to NUnit's assembly had Specific Version set to true. Seems unlikely, though. Here's a reference on how .NET locates and binds assemblies at runtime.
Somehow I managed to solve this issue... but I still don't know what caused it. I did a major cleanup of the references, excluding all the NUnit references from my project, removing all the DLLs and reintroducing the new DLL only. I can only guess that a DLL was stuck somewhere and Spring was picking it up instead of the new one... wild guess though :(
I get the following error when i try to run a console program which calls a Workflow 4 activity I created. Note the workflow compiles and runs without issue when executed from unit Tests or embedded in another workflow.
Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Logging.Database,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system
cannot find the file specified.
I am using EnterpriseLibrary 5.0 for logging and connection strings.
I notice that the path to the assemblies is as follows:
C:\Program Files (x86)\Microsoft
Enterprise Library
5.0\Bin\Microsoft.Practices.EnterpriseLibrary.*
Looking at the Assembly Binding Log is
see the following:
* Assembly Binder Log Entry (17/03/2011 # 15:32:48) *
The operation failed. Bind result: hr
= 0x80070002. The system cannot find the file specified.
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable
C:\Development\Work\EquinoxeAISManagementSystemWorkflow\EquinoxeAISManagementSystemWorkflow.FeedManager\bin\Debug\EquinoxeAISManagementSystemWorkflow.FeedManager.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: User = EQUINOXEAIS\pmckee LOG:
DisplayName =
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.414.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
(Fully-specified) LOG: Appbase =
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/
LOG: Initial PrivatePath = NULL LOG:
Dynamic Base = NULL LOG: Cache Base =
NULL LOG: AppName =
EquinoxeAISManagementSystemWorkflow.FeedManager.vshost.exe
Calling assembly :
EquinoxeAISManagementSystemWorkflow.ActivityLibrary,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null.
LOG: This bind starts in default load
context. LOG: No application
configuration file found. LOG: Using
host configuration file: LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference:
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=5.0.414.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35 LOG:
GAC Lookup was unsuccessful. LOG:
Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database.DLL.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database/Microsoft.Practices.EnterpriseLibrary.Logging.Database.DLL.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database.EXE.
LOG: Attempting download of new URL
file:///C:/Development/Work/EquinoxeAISManagementSystemWorkflow/EquinoxeAISManagementSystemWorkflow.FeedManager/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.Database/Microsoft.Practices.EnterpriseLibrary.Logging.Database.EXE.
LOG: All probing URLs attempted and
failed.
I have tried the following to resolve the issue:
- Setting 'Specific version' to False for all referanced EnterpriseLibrary assemplies
- Recreating the app.config using the EnterpriseLibrary config tool again (and again and again :(
- Deleting all references assemblies and adding them back in one by one.
I would be really grateful if anyone had further pointer as to how to debug this issue.....THANKS!
I see three possible issues...
Your app is x64 (C:\Windows\Microsoft.NET\Framework64\), is Microsoft.Practices.EnterpriseLibrary.Logging.Database x86 or x64? (never tried to do this so I'm not sure if it can be done or not)
Is this file being copied local on build? It has to be located in C:/Development/Work/[snip]/bin/Debug in order for the fusion loader to find it. Fusion won't look under every directory.
It is in the GAC, but it is not in the directory mentioned in #2. Fusion must first find the assembly under the install directory before it will probe the GAC for the assembly, IIRC*.
*this behavior depends on how the assembly is loaded at runtime using a partial bind, i.e., not using the assembly's strong name.