-
Notifications
You must be signed in to change notification settings - Fork 5
VS Debugger Stops Working After Returning from "await" Call #14
Copy link
Copy link
Open
Description
Create a .NET Core Standard 2.1 CLI project in Visual Studio, then use this code, set a breakpoint at the "await" line, then run and step through the code. When the debugger is finished stepping through the "GetPackage" function, as soon as it returns from the function, the program immediately executes the rest of the code and completes without the expected behavior of the debugger continuing to the next "int g = 9;" line, stopping, and waiting.
Any idea why the ITask is breaking the VS debugger?
using MorseCode.ITask;
using System;
using System.Threading.Tasks;
namespace ConsoleApp1_AsyncBugTest_NETCore
{
class Program
{
static async Task Main(string[] args)
{
Test test = new Test();
int j = 0;
await test.GetPackage();
int g = 9;
Console.WriteLine("Hello World!");
}
public class PackageBase
{
}
public class NullPackage : PackageBase
{
}
public class Test
{
NullPackage nullPackage;
public async ITask<NullPackage> GetPackage()
{
if (nullPackage == null)
nullPackage = new NullPackage();
return await Task.FromResult(nullPackage).AsITask();
}
}
}
}
Edit/Update: If I remove the ITask and revert back to using a regular Task, the debugger acts as expected, so it's definitely a problem with ITask.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels