.net winforms應用程序中的相同代碼正在我的機器上工作,而在其他機器上崩潰時出現以下異常。SevenZip.SevenZipExtractor構造函數在其他機器上拋出錯誤
SevenZipExtractor.SetLibraryPath(Path.Combine(Environment.CurrentDirectory,
"x86", "7z.dll"));
var extractor = new SevenZipExtractor("myfile.7z", "abcd");
Myfile.7z有Unicode文本
一些文本文件,請參閱此消息的結尾的詳細信息,調用 剛剛實時(JIT)調試而不是此對話框。
System.ArgumentException:Can not marshal:遇到無法映射的字符。 在System.String.ConvertToAnsi(BYTE * pbNativeBuffer,的Int32 cbNativeBuffer,布爾fBestFit,布爾fThrowOnUnmappableChar) 在System.StubHelpers.CSTRMarshaler.ConvertToNative(的Int32標誌,字符串strManaged,IntPtr的pNativeBuffer) 在SevenZip.NativeMethods.LoadLibrary(字符串文件名) 在SevenZip.SevenZipLibraryManager.LoadLibrary(對象用戶,枚舉格式) 在SevenZip.SevenZipExtractor.Init(字符串archiveFullName) 在SevenZip.SevenZipExtractor..ctor(字符串archiveFullName,字符串password) 在AlMadinaLibrary.Packages.Packager.GetFileObject [T](String dibx,String fileName) at TestFile.Form1.LoadDropdownList()
您在兩臺機器上測試了完全相同的7z(壓縮)文件? – mjwills
到SevenZipExtractor的第一個參數應該是一個完全合格的路徑(例如'@ 「C:\ Test.7z」')。你嘗試過嗎? – mjwills