C
C#•5w ago
Olsson

Hitting a breakpoint in a async task causes my AssemblyLoadContexts to not unload

Hi, I have this method:

async void UpdateVisuals()
{
try
{
Txt_Title.Text = _tableData.Title;
Img_Icon.SetBrushFromSoftTexture(_tableData.UIIcon);

InteractableClass = await _tableData.TargetClass.LoadAsync();
BG.BrushColor = MathLibrary.Conv_ColorToLinearColor(_tableData.TabColor);
}
catch (Exception e)
{
LogCropout.Log(e.Message);
}
}

async void UpdateVisuals()
{
try
{
Txt_Title.Text = _tableData.Title;
Img_Icon.SetBrushFromSoftTexture(_tableData.UIIcon);

InteractableClass = await _tableData.TargetClass.LoadAsync();
BG.BrushColor = MathLibrary.Conv_ColorToLinearColor(_tableData.TabColor);
}
catch (Exception e)
{
LogCropout.Log(e.Message);
}
}
Whenever I I place a breakpoint after the await, it fails to unload the AssemblyLoadContext on next hot reload that this method is in. It's like the debugger keeps a hard reference around. Any tips on how to debug this? 😄 Everything I allocate in the async is confirmed to be disposed. I just allocate a weak reference to a delegate for a callback
4 Replies
Unknown User
Unknown User•5w ago
Message Not Public
Sign In & Join Server To View
Olsson
OlssonOP•5w ago
It’s not dotnet’s hot reload It’s my own, the AssemblyLoadContext has issues unloading after the breakpoint with async
reflectronic
reflectronic•5w ago
can you try detaching the debugger after hitting the breakpoint, and seeing if the old ALC is still rooted if it is still the case, i would attach with the SOS plugin and use https://learn.microsoft.com/en-us/dotnet/standard/assembly/unloadability#debug-unloading-issues to see where the root is
Olsson
OlssonOP•4w ago
Yea, if I do that it unloads as normal I’ll check that link

Did you find this page helpful?