This project is read-only.

Exception in SevenZipLibraryManager


Whenever I try to set the Library path, I get the same exception - Invalid Path Exception in

bei System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
bei System.IO.Path.GetDirectoryName(String path)
bei SevenZip.SevenZipLibraryManager..cctor()

I have tried setting it through "7zLocation" in appsettings - same result. I am constructing my paths correctly, I have no idea why this is throwing.

Unfortunately I can't step through with a debugger and see which line this throws at, I'll try to make a minimal example and see if it still happens.


Hagn wrote Aug 22, 2013 at 5:51 PM

I just had the same problem.

It's caused by line 60 in Librarymanager.cs.
private static string _libraryFileName = ConfigurationManager.AppSettings["7zLocation"] ?? Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "7z.dll");
When embedding assemblys with tools like SmartAssembly, Assembly.GetExecutingAssembly().Location returns an empty string.

I'm currently using System.Windows.Forms.Application.ExecutablePath to bypass the problem.

Fumblesneeze wrote Aug 22, 2013 at 7:18 PM

I had loaded the assembly in question using Assembly.LoadUnsafe, the error was at the line you specified.

I have moved the intialization to the main project now (which I luckily can) which works, this issue should still get fixed I guess.

wrote Aug 22, 2013 at 8:06 PM

Fumblesneeze wrote Aug 28, 2013 at 4:39 PM

Strike my last, the issue still persists. Even though I use it in my main file which is created normally, I get this error. I am heavily using MEF so that might be a thing. Anyways, removing everything from "??" onwards solves this easily, provided you give the library the path to the dlls.

Fumblesneeze wrote Aug 28, 2013 at 6:11 PM

I also had to change this line:

static readonly string Namespace = Assembly.GetExecutingAssembly().GetManifestResourceNames()[0].Split('.')[0];