JavidPack / RecipeBrowser

RecipeBrowser mod for tModLoader
https://forums.terraria.org/index.php?threads/recipe-browser.62462/
80 stars 50 forks source link

TaskCanceledException during unloading #76

Open mazunki opened 2 years ago

mazunki commented 2 years ago

I don't think this is fatal, by any means, but it's slightly annoying to see exceptions in the logs.

[12:24:23] [.NET ThreadPool Worker/INFO] [tML]: Unloading: RecipeBrowser (Recipe Browser) v0.9.5
[12:24:23] [.NET ThreadPool Worker/DEBUG] [tML]: Unloaded 2 hooks, 2 detours and 2 native detours from RecipeBrowser in Recipe Browser
[12:24:23] [.NET ThreadPool Worker/WARN] [tML]: Silently Caught Exception: 
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at RecipeBrowser.RecipeBrowser.ConcurrentTaskHandler() in RecipeBrowser.cs:line 197
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task.CancellationCleanupLogic()
   at System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)
   at System.Threading.Tasks.Task.DelayPromiseWithCancellation.<>c.<.ctor>b__1_0(Object state, CancellationToken cancellationToken)
   at System.Threading.CancellationTokenSource.Invoke(Delegate d, Object state, CancellationTokenSource source)
   at System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback()
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   at System.Threading.CancellationTokenSource.NotifyCancellation(Boolean throwOnFirstException)
   at RecipeBrowser.RecipeBrowser.Unload() in RecipeBrowser.cs:line 130
   at Terraria.ModLoader.Mod.UnloadContent() in tModLoader\Terraria\ModLoader\Mod.Internals.cs:line 32
   at Terraria.ModLoader.ModContent.UnloadModContent() in tModLoader\Terraria\ModLoader\ModContent.cs:line 437
   at Terraria.ModLoader.ModLoader.Mods_Unload() in tModLoader\Terraria\ModLoader\ModLoader.cs:line 231
   at Terraria.ModLoader.ModLoader.Unload() in tModLoader\Terraria\ModLoader\ModLoader.cs:line 197
   at Terraria.ModLoader.ModLoader.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModLoader.cs:line 113
   at Terraria.ModLoader.ModLoader.<>c__DisplayClass47_0.<BeginLoad>b__0() in tModLoader\Terraria\ModLoader\ModLoader.cs:line 104
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

I am not sure if this is actually the fault of tml itself, but figured I'd report it anyway.

dragon3025 commented 2 years ago

I'm also experiencing this: https://hastebin.com/xadujonoko.yaml

JavidPack commented 2 years ago

Yeah, it's harmless, I'll look into seeing if I can hide it somehow.

dragon3025 commented 1 year ago

I came across this again today while rebuilding my mod. It actually pauses the game and shows the exception in visual studio (in my mod even though it's not coming from my mod). I have to tell it to ignore the exception when coming from my mod: https://pastebin.com/wbnCTEn5