Assembly binding error: during the check before loading (hr = 0x80070780), a fatal error occurred,

I have a .NET 4.5 application that works and works without problems in most environments; however, one application area throws an error in the link to the assembly of the runtime 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 merge logs and interestingly, this assembly seems to load twice, once for version 4.0.0.0, and then for version 3.5.0.0 when loading Newtonsoft.Json version 6.0.8. The first load works, and the second is a binding error.

Here is the Fusion log for successful 4.0.0.0 binding:

 <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 failed binding 3.5.0.0:

 <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 loads the assembly from the same place, and it just doesn't work a second time. I thought that this might be due to some kind of blocking of the GAC assembly, but after checking the Fusion log in the production environment, the log file is the same, only without the final error line, so it is not.

It is also interesting that this problem occurs only on Windows 10 machines, but not on all Windows 10 machines. It is also not limited to updates or new installations of Win10; it happens on both.

I have tried many things to fix this problem, including:

  • .NET Repair
  • completely remove and reinstall .NET.
  • cleaning up temporary ASP.NET files
  • adding redirects / probes to bind the assembly to the application configuration files to manually specify the file associated with the application bin folder or the root folder (this was checked for versions 3.5, 4.0 and 4.5 of the reference assembly.
  • Using Windows 10 Recovery to reinstall the OS (and save files)
  • Ensuring the required assembly is located in the GAC (at the new GAC location).
  • Re-publishing the application using the latest version of Newtonsoft.Json.
  • creating a basic test application that references Newtonsoft.Json and the same System.Xml.Linq assembly (which runs on bad machines)

I seem to be running out of options, and, unfortunately, I can't get a more specific error than Fatal Error, so I'm not sure where else to look. Any help is much appreciated!

+7
c # .net-assembly windows-10
source share

No one has answered this question yet.

See similar questions:

74
How to view folder and files in GAC?

or similar:

707
The installed assembly manifest definition does not match the assembly reference
302
I get the error "Error loading error with the wrong format" in the SQL Server replication project
219
Failed to load file or assembly or one of its dependencies
199
Could not load file or assembly ... Parameter is invalid
192
Failed to load file or assembly "Newtonsoft.Json" or one of its dependencies. The manifest definition does not match the assembly reference
86
Troubleshoot BadImageFormatException
4
DocumentFormat.OpenXml 2.5 in .NET 3.5.1 gives warnings
one
Unable to load dll from another computer
0
Issue with vs 2012 application (unit test) trying to test an application based on vs 2012

All Articles