-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tear down isn't working 100% #26
Comments
Hi @HakanL , We've occurred with the same problem in integration tests and solved it via adding pdftools to DI container. Please have a look in our code
If it looks normal I will prepare pull request to the documentation |
@sflusov Yeah, that's a workaround (to always hold a reference to it), but the issue is if you want to do a teardown then it's not working. |
We have ~1.5k integration tests which use WebApplicationFactory (TestServer) and there is no problem run it again and again. So If you provide example of code I will try to help you |
It's not a problem if you don't try to dispose (which is typically the setup with DI), but this bug was raised because it didn't work to tear it down. We would probably need to add a separate unit test to the project to test repeated setup/teardown, I don't think there is one currently, PRs welcome. |
Doing:
Works the first time, but crashes the application on subsequent calls to this method. This is solved by keeping one copy of The process cannot access the file '\bin\runtimes\win-x64\native\wkhtmltox.dll' because it is being used by another process. The file is locked by: "w3wp.exe (16856)" Docs need to be clearer on how to use SynchronizedConverter and it looks like a bit of a showstopper bug for us that something isn't being disposed properly. |
@TomGullen You should always just have a singleton/static instance of the SynchronizedConverter when using this project. I assume the teardown issue has something to do with the native library, but more investigation is needed. The examples in here use the SynchronizedConverter, but feel free to submit PR for how the docs can be improved. |
Using the same approach, with dispose (using block). Hello, World! C:...{{ some folder structure here with client-specific naming }}...\Pdf-Generator.exe (process 34660) exited with code -1073740940. So possibly the static lazy approach for |
@hidegh Yes, you absolutely have to have the |
When running unit test the testhost is kept running which holds a reference to the DLL of WkHtmlToPdf library, so if you're making changes it can't build. It's most likely something that isn't disposed/unloaded properly, but needs investigation.
The text was updated successfully, but these errors were encountered: