mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Unable to use Assembly.LoadFrom to call functions in a class library that depends on SharpCompress. #577
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KaGaMiLinAlfa on GitHub (Jul 18, 2023).
I have two programs, one is a console application called ConsoleApp, and the other is a class library called ClassLibrary. Both of them are built using Core 3.1.
ConsoleApp does not reference SharpCompress, while ClassLibrary references and uses SharpCompress 33.0.
In ConsoleApp, I use Assembly.LoadFrom to load ClassLibrary and invoke related functions. However, when calling these functions
I encounter an error with the following message: 'The type initializer for 'SharpCompress.Common.ArchiveEncoding' threw an exception.'
If I add a reference to SharpCompress in ConsoleApp, the error does not occur. Why does this happen?
I want ConsoleApp to be able to call the functions in ClassLibrary without referencing SharpCompress. Is there any solution available?
I have been researching this issue for quite some time but haven't found a solution. I would appreciate any help. Thank you!
Here is the code I'm using for debugging purposes:
ConsoleApp.cs:
ClassLibrary.Class1: