luuksommers / SevenZipSharp.Interop

Other
36 stars 10 forks source link

File not available does not catch #9

Closed ziercool closed 5 years ago

ziercool commented 5 years ago

If there is no access to the file, catch is not caught with the application crashing and text in the debugger -

System.Reflection.TargetInvocationException: "The destination of the call threw an exception."

Internal exception: UnauthorizedAccessException: Access denied on path "......".

Currently, the latest library from nuget is used. If a file or folder is available, everything works.

System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledНеобработанное исключениеProgramm.exeSystem.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089The destination of the call threw an exception. в System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) в System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) в System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) в SevenZip.SevenZipBase.AsyncCallbackMethod(IAsyncResult ar) в System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage msg) в System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink) в System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Object o) в System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) в System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() в System.Threading.ThreadPoolWorkQueue.Dispatch() в System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()System.Reflection.TargetInvocationException: The destination of the call threw an exception. ---> System.UnauthorizedAccessException: Access denied on path "...".

Server stack trace: в SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e) в SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, CallbackBase handler) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames) в System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) в System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: в System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) в System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) в SevenZip.SevenZipCompressor.CompressFiles1Delegate.EndInvoke(IAsyncResult result)

в System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) в System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) в System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) в SevenZip.SevenZipBase.AsyncCallbackMethod(IAsyncResult ar) в System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage msg) в System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink) в System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Object o) в System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) в System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() в System.Threading.ThreadPoolWorkQueue.Dispatch() в System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()System.UnauthorizedAccessException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Access denied on path "...". Server stack trace: в SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e) в SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, CallbackBase handler) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames) в System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) в System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: в System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) в System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) в SevenZip.SevenZipCompressor.CompressFiles1Delegate.EndInvoke(IAsyncResult result)System.UnauthorizedAccessException: Access denied on path "...".

Server stack trace: в SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e) в SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, CallbackBase handler) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames) в SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames) в System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) в System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: в System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) в System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) в SevenZip.SevenZipCompressor.CompressFiles1Delegate.EndInvoke(IAsyncResult result)

luuksommers commented 5 years ago

This is a bug in SevenZipSharp itself, please check https://github.com/tomap/SevenZipSharp (Nuget) for the new fork as the original SevenZipSharp has been deprecated (https://www.nuget.org/packages/SevenZipSharp).