I have an async function that doesn't throw anything:
public async Task SomeLongComputations()
{
// do some stuff that takes a lot of time
}
that I just want it to run in the background, without intervening the main thread:
public void SomeFunctionInMainThread()
{
_ = SomeLongComputations();
}
But when I debugged the code in Visual Studio and set a breakpoint inside SomeLongComputations
, it still shows that it is ran on main thread (thread id == 1).
Some additional context, not sure if it is relevant:
- I am developing an extension for Visual Studio
- The threads are created inside an event handler for
ITextBuffer.Changed
andIWpfTextView.LayoutChanged
- In the debug window, I can still see other threads