Carlos Quintero (Microsoft MVP) blog

Visual Studio Extensibility with Add-ins

The strange case of error 80131018 loading a Visual Studio add-in

A couple of weeks ago a received an error report from a customer of my MZ-Tools add-in saying that VS 2005 failed to load it with error "Unknown error" and error code 0x80131018. Searching my e-mail history it happened that that error was already reported by a previous customer months ago, but it was not clear how it was solved. The current customer tried to reinstall the add-in, to reinstall VS 2005 and even to format the hard drive, to no avail. Searching on the web, there is little information about this error, only that it is mapped to COR_E_ASSEMBLYEXPECTED and that it caused because a .NET assembly doesn't have a manifest, that is, it is not a .NET assembly actually. In fact, this method is used to know if a DLL is a .NET assembly or not. But how could it be that a .NET add-in assembly does have a missing manifest? The customer sent it to me and the manifest was there. In fact, it loaded perfectly on my machine, and on another machine of him. The fuslogvw.exe tool gave this log:

LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe.Config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files/MZTools2005/MZTools5.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\MZTools2005\MZTools5.dll
LOG: Entering run-from-source setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131018).
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.

In the tests that I asked him to perform, the assembly loaded correctly using Assembly.LoadFrom from a Windows application or using the Reflector for .NET tool, so the error happened only inside VS 2005.

Finally, and when I was quite desperate with this problem, the customer discovered that the problem was caused by the version 2007 of his antivirus, which I won't cite, but suffice to say that the culprit was its "Protection Against Unknown Threats" feature. As soon as he deactivated that feature, the add-in loaded quite happily.

I hope this helps if you ever find this problem.

Published Fri, Mar 23 2007 14:51 by carlosq

Comments

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Sunday, March 25, 2007 2:23 PM

Great catch! Thanks!

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Monday, May 14, 2007 5:26 AM

Carlos can't says the name of the Antivirus, me as a Certified Reseller can. The Antivirus is Panda Antivirus. In my case I get the trouble strangely in the middle of the work. From one moment to another the MZ toolbar disappeared. Reinstalling the new version I got that exception, and despite was able to load the assembly with the LoadFile Method on VS I wasn't able to see again my toolbar. The solution is close VS; manually unregister the dll with the RegAssembly20 /u MzTools5.dll, wait the end, reinstall, open VS, re-enable Antivirus. Bye Andrea

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Monday, October 20, 2008 9:18 AM

Thank you for valuable information.

by ...

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Tuesday, March 17, 2009 7:15 AM

I've had a similar problem with References not resolving properly on one machine, while they do on other machines. After I read this post, I tried to disable the TruPrevent feature of Panda Antivirus, and suddenly it worked! So thanks for the info! =)

by Eirik Iversen

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Thursday, April 30, 2009 12:15 PM

I had the same problem when referencing any downloaded dll in my projects (rhino mocks, log4net, castle windsor, ...). After disabling TruPrevent the problem is gone.

Thanks!

by Panagiotis Parissis

# re: The strange case of error 80131018 loading a Visual Studio add-in @ Friday, July 17, 2009 3:18 AM

The problem still exists in Panda Antivirus. Thankfully I found this blog item which solved my problem directly.

by Arthur Pijpers

Leave a Comment

(required) 
(required) 
(optional)
(required)