This project has moved and is read-only. For the latest updates, please go here.


If something is wrong with the stream, Html2OpenXml crashes and won't recover


I played around with several setups and always run in the same problem. I currently have a setup based on the MS example:
This saves a word document on my hard drive. All works fine.

Now lets break the stream: Leave the document opened in Word, and I get the expected exception:
The process cannot access the file "" because it is being used by another process.
Everytime after I try to use Html2OpenXml again I get the following persistent error:
Could not load file or assembly 'HtmlToOpenXml, Version=, Culture=neutral, PublicKeyToken=6ad79d83e2b60e63' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"HtmlToOpenXml, Version=, Culture=neutral, PublicKeyToken=6ad79d83e2b60e63
I need to restart my session to get out of this error. I have a the same issue with the example on your page.
Is this a known bug?
Closed Sep 26, 2016 at 4:13 PM by onizet
This wasn't a bug on this library


onizet wrote May 12, 2016 at 10:08 PM


I'm sorry but this is really related to .Net, not to this library.
Make sure to close the filestream before exiting your application. Ensure to leave the application when you caught the error. I often got this exception when debugging and never ever got the error persistently.

Do you have the library in the GAC ? It seems like a conflict occurs....

Coolkau wrote May 12, 2016 at 10:33 PM

Hi onizet,

thanks for your quick reply and also for your great software.

I think found the issue (the error happens not reproducibly at the same time so I will test it a bit more).

I realized that I use .net 4.6 and not .net 4.0, so I downloaded the source code and compiled it with target 4.6 which thankfully worked nicely. Using this version everything seems to work. So I guess I am sorry, this error was on me.

Thanks again.

(note on the side: I only found the 1.5 version on nuGet, not the 1.6)

wrote Sep 26, 2016 at 4:13 PM