After migrating a WPF application to dotnet core 3 I am getting a TaskCancelledException in Visual Studio debugger every time the application is closing.
This behavior was not seen using .NetFramework.
The application follows MVVM pattern and does some async CRUD operations, is there any chance I can see where the problem is or how can I see which task returns this exception?
I am closing the app using Application.Current.Shutdown();
if this is for any help.
The methods doing async CRUD are not using any CancellationToken.
I know I should share some code, but I do not know where to start from.
Here is the stack:
System.Threading.Tasks.TaskCanceledException
HResult=0x8013153B
Message=A task was canceled.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback)
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.Properties.PropertyService.GetPropertyValuesChainInternal(Int64 instanceHandle, Object targetObject)
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.Properties.PropertyService.HandlePropertyChainRequest(PropertiesRequestInfo requestInfo)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.HandleMessage[TMessage,TReply](Func`2 callback, Message request)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.<>c__DisplayClass27_0`2.<RegisterMessageObserver>b__0(Message message)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.ProcessInboundMessage(Message message)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.<>c__DisplayClass40_0.<OnMessageReceived>b__0()
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.WaitableActionsList.<>c__DisplayClass8_0.<AddAndSignal>b__0(Boolean isCancelled)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.ActionThread(Object list)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart(Object obj)
According to https://github.com/grpc/grpc/issues/11328 , it "is basically a Visual Studio debugger feature". So, as sayd by @Kevin Gosse, "it should happen only in debug mode": "To verify that, try disabling the debugging tools by going to Tools -> Options -> Debugging and unchecking Enable UI Debugging Tools for XAML"
User contributions licensed under CC BY-SA 3.0