[wasm][debugger] Adding test for #42421 (#89395)
authorThays Grazia <thaystg@gmail.com>
Wed, 26 Jul 2023 14:04:04 +0000 (11:04 -0300)
committerGitHub <noreply@github.com>
Wed, 26 Jul 2023 14:04:04 +0000 (11:04 -0300)
* Adding test for #42421

* Remove pdb to simulate the same scenario that a customer has.

* Fix tests that have a different behavior without system.private.corelib.pdb

src/mono/wasm/debugger/DebuggerTestSuite/AsyncTests.cs
src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs
src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj

index 0711883..592f6ef 100644 (file)
@@ -154,5 +154,20 @@ namespace DebuggerTests
                 }
             );
         }
+
+        [ConditionalFact(nameof(WasmSingleThreaded), nameof(RunningOnChrome))]
+        public async Task StepOutOfAsyncMethod()
+        {
+            await SetJustMyCode(true);
+            string source_file = "dotnet://debugger-test.dll/debugger-async-step.cs";
+
+            await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.AsyncStepClass", "TestAsyncStepOut2", 2);
+            await EvaluateAndCheck(
+                "window.setTimeout(function() { invoke_static_method_async('[debugger-test] DebuggerTests.AsyncStepClass:TestAsyncStepOut'); }, 1);",
+                "dotnet://debugger-test.dll/debugger-async-step.cs", 21, 12,
+                "DebuggerTests.AsyncStepClass.TestAsyncStepOut2");
+
+            await StepAndCheck(StepKind.Out, source_file, 16, 8, "DebuggerTests.AsyncStepClass.TestAsyncStepOut");
+        }
     }
 }
index f251ceb..356f7bb 100644 (file)
@@ -839,9 +839,9 @@ namespace DebuggerTests
         [Theory]
         [InlineData("IDefaultInterface", "DefaultMethod", "Evaluate", "DefaultInterfaceMethod.Evaluate", 1089, 1005, 1003, 1007)]
         [InlineData("IExtendIDefaultInterface", "IDefaultInterface.DefaultMethodToOverride", "Evaluate", "DefaultInterfaceMethod.Evaluate", 1090, 1049, 1047, 1051)]
-        [InlineData("IDefaultInterface", "DefaultMethodAsync", "EvaluateAsync", "System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<IDefaultInterface.<DefaultMethodAsync>d__3>", 37, 1018, 1016, 1020)]
+        [InlineData("IDefaultInterface", "DefaultMethodAsync", "EvaluateAsync", "DefaultInterfaceMethod.EvaluateAsync", 1097, 1018, 1016, 1020)]
         [InlineData("IDefaultInterface", "DefaultMethodStatic", "EvaluateStatic", "DefaultInterfaceMethod.EvaluateStatic", 1126, 1024, 1022, 1026)]
-        [InlineData("IDefaultInterface", "DefaultMethodAsyncStatic", "EvaluateAsyncStatic", "System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<IDefaultInterface.<DefaultMethodAsyncStatic>d__5>", 37, 1033, 1031, 1035)]
+        [InlineData("IDefaultInterface", "DefaultMethodAsyncStatic", "EvaluateAsyncStatic", "DefaultInterfaceMethod.EvaluateAsyncStatic", 1131, 1033, 1031, 1035)]
         public async Task BreakInDefaultInterfaceMethod(
             string dimClassName, string dimName, string entryMethod,  string prevFrameInDim, int evaluateAsPrevFrameLine, int dimAsPrevFrameLine, int functionLocationLine, int functionEndLine)
         {
index 3d1ca30..3dad652 100644 (file)
@@ -52,7 +52,8 @@
   <Target Name="PrepareForWasmBuildApp" DependsOnTargets="Build">
     <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)native')"
            Text="Cannot find %24(MicrosoftNetCoreAppRuntimePackRidDir)=$(MicrosoftNetCoreAppRuntimePackRidDir)native. Make sure to set the runtime configuration with %24(RuntimeConfiguration). Current value: $(RuntimeConfiguration)" />
-
+    <!-- Remove pdb from System.Private.CoreLib to have the same scenario that we have in a Blazor/Wasm user app -->
+    <Delete Files="$(MicrosoftNetCoreAppRuntimePackRidDir)native/System.Private.CoreLib.pdb" />   
     <PropertyGroup>
       <EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle>
       <WasmAppDir>$(AppDir)</WasmAppDir>