-
Notifications
You must be signed in to change notification settings - Fork 10
Description
In a long-lived application, after creating an archive with a short-lived ArchiveWriter, an ExecutionEngineException is encountered on garbage collection.
If a reference is kept to another instance of ArchiveWriter, the exception isn't encountered, so it seems the error is only encountered when FreeLibrary is allowed on the 7z.dll when no other instances are holding the library open. If a short-lived ArchiveWriter is created but not used to create an archive, no exceptions are encountered, which leads the tracing of the issue to SevenZipLibrary.GetOutArchive and creation of the IOutArchive instance. After calling IOutArchive.UpdateItems, the IOutArchive instance should probably be released with Marshal.FinalReleaseComObject.
This should also probably be applied to other objects created by CreateObjectDelegate.