Repository navigation
Labels
Description
Program.cs:
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
Console.WriteLine(RuntimeInformation.FrameworkDescription);
await OuterAsync();
static async Task OuterAsync()
{
await Task.CompletedTask;
await MiddleAsync();
}
static async Task MiddleAsync()
{
await Task.CompletedTask;
await InnerAsync();
throw new InvalidOperationException("boom");
}
static async Task InnerAsync()
{
await Task.CompletedTask;
}project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Features Condition="'$(TargetFramework)' == 'net11.0'">runtime-async=on</Features>
</PropertyGroup>
</Project>.NET 10 (everything default):
$ dotnet run -f net10.0
.NET 10.0.8
Unhandled exception. System.InvalidOperationException: boom
at Program.<<Main>$>g__MiddleAsync|0_1() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 24
at Program.<<Main>$>g__OuterAsync|0_0() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 15
at Program.<Main>$(String[] args) in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 10
at Program.<Main>(String[] args).NET 11 (async v2 off):
dotnet run -f net11.0
.NET 11.0.0-preview.4.26230.115
Unhandled exception. System.InvalidOperationException: boom
at Program.<<Main>$>g__MiddleAsync|0_1() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 24
at Program.<<Main>$>g__OuterAsync|0_0() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 15
at Program.<Main>$(String[] args) in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 10
at Program.<Main>(String[] args)
at System.Environment.CallEntryPoint(IntPtr entryPoint, String[]* pArgument, Int32* pReturnValue, Boolean captureException, Exception* pException).NET 11 (async v2 on):
dotnet run -f net11.0
.NET 11.0.0-preview.4.26230.115
Unhandled exception. System.InvalidOperationException: boom
at Program.<<Main>$>g__MiddleAsync|0_1() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 24
at Program.<<Main>$>g__OuterAsync|0_0() in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 15
at Program.<Main>$(String[] args) in /Users/rich/git/build-talk-2026/runtime-async-demo/Program.cs:line 10
--- End of stack trace from previous location ---
at Program.<Main>(String[] args)
at System.Environment.CallEntryPoint(IntPtr entryPoint, String[]* pArgument, Int32* pReturnValue, Boolean captureException, Exception* pException)Both of the .NET 11 examples are different from the .NET 10 baseline.
Activity
richlander commentedon May 28, 2026
As a side-note, I was surprised that all the methods are
g__. That's due to top-level statements since a class needs to be materialized. That's not a concern but FYI for anyone wondering.jkotas commentedon May 28, 2026
#127677
rcj1 commentedon May 29, 2026
We have filtered out these spurious markers in asyncv1 here:
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs
Line 361 in e885bb9
The issue had been masked because if we resume before throwing, this marker just so happens to land on the
DispatchContinuationsstack trace hidden method, and we only print the marker if it lands on non-hidden code. I linked the PR to fix this.richlander commentedon May 29, 2026
Thanks to both of you. These are good fixes to make this new feature look good.
dotnet-policy-service commentedon May 29, 2026
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.
Skipping EDI in the runtime-async case as well (#128735)
MichalStrehovsky commentedon Jun 9, 2026
This was reverted.
rcj1 commentedon Jun 9, 2026
I’ll have a quick look at the NAOT v1 stacktrace and if there is no regression with V2 I will just exclude the tests on NAOT
Redo 128735 with NAOT exclusion (#129151)
Skipping EDI in the runtime-async case as well (#128735)
Redo 128735 with NAOT exclusion (#129151)
Skipping EDI in the runtime-async case as well (dotnet#128735)
Redo 128735 with NAOT exclusion (dotnet#129151)