theraot / Theraot

Backporting .NET and more: LINQ expressions in .net 2.0 - nuget Theraot.Core available.
MIT License
158 stars 30 forks source link

Hang on ValueTaskAwaiter.GetResult() #145

Closed OwnageIsMagic closed 3 years ago

OwnageIsMagic commented 3 years ago

Targeting net403

async ValueTask xxx() { }

xxx().GetAwaiter().GetResult();
    mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout = -1, System.Threading.CancellationToken cancellationToken) C#  Symbols loaded.
    mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    C#  Symbols loaded.
    mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout = -1, System.Threading.CancellationToken cancellationToken)   C#  Symbols loaded.
    mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)    C#  Symbols loaded.
    [Waiting on Async Operation, double-click or press enter to view Async Call Stacks]     Annotated Frame
>   Theraot.Core.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(System.Threading.Tasks.Task task = Id = 2, Status = WaitingForActivation, Method = "{null}")  C#  Symbols loaded.
    Theraot.Core.dll!System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()   C#  Symbols loaded.
    NewAgent.exe!NewAgent.Program.Main(string[] args = {string[0]}) C#  Symbols loaded.
OwnageIsMagic commented 3 years ago

It doesn't hang on await ValueTask.FromResult(1), only when awaiting async functions.

theraot commented 3 years ago

Pushed Nuget 3.2.4 with this fix