MetroLog
MetroLog copied to clipboard
Unobserved Task Exception when using MetroLog
Hi,
I am hitting this unobserved task exception when using MetroLog:
Exception: InnerException = {"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetroLog.FileTarget.<GetWritableStreamForFile>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetroLog.Targets.FileTargetBase.<GetOrCreateStreamWriterForFile>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetroLog.Targets.FileTargetBase.<WriteAsyncCore>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MetroLog.Targets.Target.<WriteAsync>d__5.MoveNext()
Any idea?
I am using the logger from multiple threads, is it thread safe?
Thanks, Christian
Might be similar to https://github.com/onovotny/MetroLog/issues/74?
System.UnauthorizedAccessException occurred Message: Exception thrown: 'System.UnauthorizedAccessException' in System.Runtime.WindowsRuntime.dll Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
> mscorlib.ni.dll!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) Unknown
System.Runtime.WindowsRuntime.dll!System.IO.WindowsRuntimeStorageExtensions.OpenStreamForWriteAsyncCore(Windows.Storage.IStorageFile windowsRuntimeFile, long offset) Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1>(ref System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1 stateMachine) Unknown
System.Runtime.WindowsRuntime.dll!System.IO.WindowsRuntimeStorageExtensions.OpenStreamForWriteAsyncCore(Windows.Storage.IStorageFile windowsRuntimeFile, long offset) Unknown
System.Runtime.WindowsRuntime.dll!System.IO.WindowsRuntimeStorageExtensions.OpenStreamForWriteAsync(Windows.Storage.IStorageFile windowsRuntimeFile) Unknown
MetroLog.dll!MetroLog.FileTarget.GetWritableStreamForFile(string fileName) Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) Unknown
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Unknown
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Unknown
mscorlib.ni.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask) Unknown
mscorlib.ni.dll!System.Threading.Tasks.Task.FinishContinuations() Unknown
mscorlib.ni.dll!System.Threading.Tasks.Task.FinishStageThree() Unknown
mscorlib.ni.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result) Unknown
mscorlib.ni.dll!System.Threading.Tasks.TaskCompletionSource<Windows.Storage.StorageFile>.TrySetResult(Windows.Storage.StorageFile result) Unknown
System.Runtime.WindowsRuntime.dll!System.Threading.Tasks.AsyncInfoToTaskBridge<Windows.Storage.StorageFile, System.VoidValueTypeParameter>.Complete(Windows.Foundation.IAsyncInfo asyncInfo, System.Func<Windows.Foundation.IAsyncInfo, Windows.Storage.StorageFile> getResultsFunction, Windows.Foundation.AsyncStatus asyncStatus) Unknown
System.Runtime.WindowsRuntime.dll!System.Threading.Tasks.AsyncInfoToTaskBridge<Windows.Storage.StorageFile, System.VoidValueTypeParameter>.CompleteFromAsyncOperation(Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile> asyncInfo, Windows.Foundation.AsyncStatus asyncStatus) Unknown
Same here. Any news on this issue?
36|2016-05-26T10:19:58.2746895+00:00|ERROR|14|App|UnhandledException --> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.IO.WindowsRuntimeStorageExtensions.<OpenStreamForWriteAsyncCore>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MetroLog.FileTarget.<GetWritableStreamForFile>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MetroLog.Targets.FileTargetBase.<GetOrCreateStreamWriterForFile>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MetroLog.Targets.FileTargetBase.<WriteAsyncCore>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MetroLog.Targets.Target.<WriteAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MetroLog.GlobalCrashHandler.<App_UnhandledException>d__1.MoveNext()
I want to add: I get the same Exception when i try to open a file which has allready been openend by MetroLog. So I believe that you "double open" a Log file under certain circumstances.
I've got the same issue but it only occurs when in RELEASE (.Net Native) mode not DEBUG.
Having same issue in the release mode .. Any hacks or updates on this issue ?
+1, on Xamarin Forms UWP