From 311e47ea378c63b79968b1834930ce085c38eeee Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Tue, 15 Sep 2026 11:41:33 -0700 Subject: [PATCH] Revert test tree changes from #133768 Restore the runtime async test tree to its state before #133768 while retaining the product changes from that PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27ac1edf-14a6-4f36-b2d7-87bb83df4db0 --- src/tests/async/Directory.Build.targets | 4 +- src/tests/async/async.csproj | 5 +- .../diagnostic-ip-stacktrace.cs | 73 ------------------- .../diagnostic-ip-stacktrace.csproj | 8 -- 4 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.cs delete mode 100644 src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.csproj diff --git a/src/tests/async/Directory.Build.targets b/src/tests/async/Directory.Build.targets index dde2d82849f3d4..3467f16c2be66f 100644 --- a/src/tests/async/Directory.Build.targets +++ b/src/tests/async/Directory.Build.targets @@ -1,7 +1,7 @@ - - true + + true diff --git a/src/tests/async/async.csproj b/src/tests/async/async.csproj index c7c5eb790b4efc..838e11a3ffe49b 100644 --- a/src/tests/async/async.csproj +++ b/src/tests/async/async.csproj @@ -1,9 +1,6 @@ - - true - - + diff --git a/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.cs b/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.cs deleted file mode 100644 index 8f092ed3dff93e..00000000000000 --- a/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using Xunit; - -public class RuntimeAsyncDiagnosticIPStackTrace -{ - [Fact] - public static void TestEntryPoint() - { - TaskCompletionSource suspension = new(); - Task task = Level1(suspension.Task); - - Assert.False(task.IsCompleted); - suspension.SetResult(); - Assert.True(task.IsCompleted); - - InvalidOperationException? exception = null; - try - { - task.GetAwaiter().GetResult(); - } - catch (InvalidOperationException ex) - { - exception = ex; - } - - Assert.NotNull(exception); - string stackTrace = exception.StackTrace; - Assert.NotNull(stackTrace); - Console.WriteLine(stackTrace); - - string[] expectedMethods = - [ - nameof(ThrowAfterResume), - nameof(Level4), - nameof(Level3), - nameof(Level2), - nameof(Level1), - ]; - - int previousFrame = -1; - foreach (string method in expectedMethods) - { - string frame = $"{nameof(RuntimeAsyncDiagnosticIPStackTrace)}.{method}("; - int currentFrame = stackTrace.IndexOf(frame, StringComparison.Ordinal); - Assert.True(currentFrame > previousFrame, $"Expected '{frame}' after offset {previousFrame} in:{Environment.NewLine}{stackTrace}"); - previousFrame = currentFrame; - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private static async Task Level1(Task suspension) => await Level2(suspension); - - [MethodImpl(MethodImplOptions.NoInlining)] - private static async Task Level2(Task suspension) => await Level3(suspension); - - [MethodImpl(MethodImplOptions.NoInlining)] - private static async Task Level3(Task suspension) => await Level4(suspension); - - [MethodImpl(MethodImplOptions.NoInlining)] - private static async Task Level4(Task suspension) => await ThrowAfterResume(suspension); - - [MethodImpl(MethodImplOptions.NoInlining)] - private static async Task ThrowAfterResume(Task suspension) - { - await suspension; - throw new InvalidOperationException(); - } -} diff --git a/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.csproj b/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.csproj deleted file mode 100644 index 93f95480eb6c91..00000000000000 --- a/src/tests/async/diagnostic-ip-stacktrace/diagnostic-ip-stacktrace.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - true - - - - -