From 23981e336e5926f19150c5015217694cbabc9d90 Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Wed, 24 Aug 2022 15:20:43 -0300 Subject: [PATCH 1/3] Fix chinese character in project name --- .../wasm/debugger/BrowserDebugProxy/DebugStore.cs | 3 ++- .../wasm/debugger/DebuggerTestSuite/MiscTests.cs | 12 ++++++++++++ ...er-test-chinese-char-in-path-\343\204\250.csproj" | 5 +++++ .../test.cs" | 10 ++++++++++ .../tests/debugger-test/debugger-test.csproj | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 "src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" create mode 100644 "src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/test.cs" diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs index f98932d7372ed9..e414c809abc042 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs @@ -1469,11 +1469,12 @@ public async IAsyncEnumerable Load(SessionId id, string[] loaded_fil continue; try { + string decodedFileName = Uri.UnescapeDataString(file_name); steps.Add( new DebugItem { Url = file_name, - Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(file_name), token) + Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(decodedFileName), token) }); } catch (Exception e) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs index 50ebc7704388ce..b722b954b70c71 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs @@ -1086,5 +1086,17 @@ await EvaluateAndCheck( } ); } + + [ConditionalFact(nameof(RunningOnChrome))] + public async Task SetBreakpointInProjectWithChineseCharactereInPath() + { + var bp = await SetBreakpointInMethod("debugger-test-chinese-char-in-path-ㄨ.dll", "DebuggerTests.CheckChineseCharacterInPath", "Evaluate", 1); + await EvaluateAndCheck( + $"window.setTimeout(function() {{ invoke_static_method ('[debugger-test-chinese-char-in-path-ㄨ] DebuggerTests.CheckChineseCharacterInPath:Evaluate'); }}, 1);", + "dotnet://debugger-test-chinese-char-in-path-ㄨ.dll/test.cs", + bp.Value["locations"][0]["lineNumber"].Value(), + bp.Value["locations"][0]["columnNumber"].Value(), + $"DebuggerTests.CheckChineseCharacterInPath.Evaluate"); + } } } diff --git "a/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" new file mode 100644 index 00000000000000..d75d7cd720ac04 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" @@ -0,0 +1,5 @@ + + + false + + diff --git "a/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/test.cs" "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/test.cs" new file mode 100644 index 00000000000000..6902b401317936 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/test.cs" @@ -0,0 +1,10 @@ +namespace DebuggerTests +{ + public class CheckChineseCharacterInPath + { + public static void Evaluate() + { + var a = 123; + } + } +} diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj index 0e457832913513..40c0b39df330c1 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj @@ -21,6 +21,7 @@ + @@ -53,6 +54,7 @@ + From a9e112113d6014b8f8d31b0b6d54628350ca481d Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Wed, 24 Aug 2022 17:14:56 -0300 Subject: [PATCH 2/3] Adding more tests as suggested by @radical Renaming variable as suggested by @radical --- .../debugger/BrowserDebugProxy/DebugStore.cs | 4 +- .../DebuggerTestSuite/HotReloadTests.cs | 44 ++++---- .../debugger/DebuggerTestSuite/MiscTests.cs | 14 ++- ...emblyChineseCharInPath\343\204\250.csproj" | 36 ++++++ .../MethodBody0.cs" | 15 +++ .../MethodBody1.cs" | 60 ++++++++++ .../MethodBody1_v1.cs" | 87 ++++++++++++++ .../MethodBody1_v2.cs" | 106 ++++++++++++++++++ .../deltascript.json" | 7 ++ .../tests/debugger-test/debugger-test.csproj | 5 + ...-chinese-char-in-path-\343\204\250.csproj" | 2 + .../lazy-debugger-test.cs" | 25 +++++ 12 files changed, 377 insertions(+), 28 deletions(-) create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250.csproj" create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody0.cs" create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1.cs" create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v1.cs" create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v2.cs" create mode 100644 "src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/deltascript.json" create mode 100644 "src/mono/wasm/debugger/tests/lazy-debugger-test-chinese-char-in-path-\343\204\250/lazy-debugger-test-chinese-char-in-path-\343\204\250.csproj" create mode 100644 "src/mono/wasm/debugger/tests/lazy-debugger-test-chinese-char-in-path-\343\204\250/lazy-debugger-test.cs" diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs index e414c809abc042..3c015f83add7f3 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs @@ -1469,12 +1469,12 @@ public async IAsyncEnumerable Load(SessionId id, string[] loaded_fil continue; try { - string decodedFileName = Uri.UnescapeDataString(file_name); + string unescapedFileName = Uri.UnescapeDataString(file_name); steps.Add( new DebugItem { Url = file_name, - Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(decodedFileName), token) + Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(unescapedFileName), token) }); } catch (Exception e) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs index 146ecaebac862c..7e5f5fa3cd8102 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/HotReloadTests.cs @@ -51,35 +51,37 @@ public async Task DebugHotReloadMethodUnchanged() CheckNumber(locals, "a", 10); } - [ConditionalFact(nameof(RunningOnChrome))] - public async Task DebugHotReloadMethodAddBreakpoint() + [ConditionalTheory(nameof(RunningOnChrome))] + [InlineData("ApplyUpdateReferencedAssembly")] + [InlineData("ApplyUpdateReferencedAssemblyChineseCharInPathㄨ")] + public async Task DebugHotReloadMethodAddBreakpoint(string assembly_name) { int line = 30; await SetBreakpoint(".*/MethodBody1.cs$", line, 12, use_regex: true); var pause_location = await LoadAssemblyAndTestHotReload( - Path.Combine(DebuggerTestAppPath, "ApplyUpdateReferencedAssembly.dll"), - Path.Combine(DebuggerTestAppPath, "ApplyUpdateReferencedAssembly.pdb"), - Path.Combine(DebuggerTestAppPath, "../wasm/ApplyUpdateReferencedAssembly.dll"), + Path.Combine(DebuggerTestAppPath, $"{assembly_name}.dll"), + Path.Combine(DebuggerTestAppPath, $"{assembly_name}.pdb"), + Path.Combine(DebuggerTestAppPath, $"../wasm/{assembly_name}.dll"), "MethodBody3", "StaticMethod3", expectBpResolvedEvent: true); var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); CheckNumber(locals, "a", 10); - pause_location = await SendCommandAndCheck(JObject.FromObject(new { }), "Debugger.resume", "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 30, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3"); + pause_location = await SendCommandAndCheck(JObject.FromObject(new { }), "Debugger.resume", $"dotnet://{assembly_name}.dll/MethodBody1.cs", 30, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3"); locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); CheckNumber(locals, "b", 15); - pause_location = await SendCommandAndCheck(JObject.FromObject(new { }), "Debugger.resume", "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 30, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3"); + pause_location = await SendCommandAndCheck(JObject.FromObject(new { }), "Debugger.resume", $"dotnet://{assembly_name}.dll/MethodBody1.cs", 30, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3"); locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); await CheckBool(locals, "c", true); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 31, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 31, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); await Task.CompletedTask; } ); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 32, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 32, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); @@ -87,7 +89,7 @@ await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/Me await Task.CompletedTask; } ); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 33, 8, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 33, 8, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); @@ -217,12 +219,14 @@ public async Task DebugHotReloadMethodUnchangedUsingSDB() CheckLocation("dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 21, 12, scripts, top_frame["location"]); } - [ConditionalFact(nameof(RunningOnChrome))] - public async Task DebugHotReloadMethodAddBreakpointUsingSDB() + [ConditionalTheory(nameof(RunningOnChrome))] + [InlineData("ApplyUpdateReferencedAssembly")] + [InlineData("ApplyUpdateReferencedAssemblyChineseCharInPathㄨ")] + public async Task DebugHotReloadMethodAddBreakpointUsingSDB(string assembly_name) { - string asm_file = Path.Combine(DebuggerTestAppPath, "ApplyUpdateReferencedAssembly.dll"); - string pdb_file = Path.Combine(DebuggerTestAppPath, "ApplyUpdateReferencedAssembly.pdb"); - string asm_file_hot_reload = Path.Combine(DebuggerTestAppPath, "../wasm/ApplyUpdateReferencedAssembly.dll"); + string asm_file = Path.Combine(DebuggerTestAppPath, $"{assembly_name}.dll"); + string pdb_file = Path.Combine(DebuggerTestAppPath, $"{assembly_name}.pdb"); + string asm_file_hot_reload = Path.Combine(DebuggerTestAppPath, $"../wasm/{assembly_name}.dll"); int line = 30; await SetBreakpoint(".*/MethodBody1.cs$", line, 12, use_regex: true); @@ -238,7 +242,7 @@ public async Task DebugHotReloadMethodAddBreakpointUsingSDB() JToken top_frame = pause_location["callFrames"]?[0]; AssertEqual("ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", top_frame?["functionName"]?.Value(), top_frame?.ToString()); - CheckLocation("dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 30, 12, scripts, top_frame["location"]); + CheckLocation($"dotnet://{assembly_name}.dll/MethodBody1.cs", 30, 12, scripts, top_frame["location"]); locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); CheckNumber(locals, "b", 15); @@ -249,19 +253,19 @@ public async Task DebugHotReloadMethodAddBreakpointUsingSDB() top_frame = pause_location["callFrames"]?[0]; AssertEqual("ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", top_frame?["functionName"]?.Value(), top_frame?.ToString()); - CheckLocation("dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 30, 12, scripts, top_frame["location"]); + CheckLocation($"dotnet://{assembly_name}.dll/MethodBody1.cs", 30, 12, scripts, top_frame["location"]); locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); await CheckBool(locals, "c", true); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 31, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 31, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); await Task.CompletedTask; } ); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 32, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 32, 12, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); @@ -269,7 +273,7 @@ await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/Me await Task.CompletedTask; } ); - await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 33, 8, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", + await StepAndCheck(StepKind.Over, $"dotnet://{assembly_name}.dll/MethodBody1.cs", 33, 8, "ApplyUpdateReferencedAssembly.MethodBody3.StaticMethod3", locals_fn: async (locals) => { CheckNumber(locals, "d", 10); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs index b722b954b70c71..9973811a56e499 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs @@ -735,23 +735,25 @@ JObject FindFrame(JObject pause_location, string function_name) ?.Where(f => f["functionName"]?.Value() == function_name) ?.FirstOrDefault(); - [ConditionalFact(nameof(RunningOnChrome))] - public async Task DebugLazyLoadedAssemblyWithPdb() + [ConditionalTheory(nameof(RunningOnChrome))] + [InlineData("lazy-debugger-test")] + [InlineData("lazy-debugger-test-chinese-char-in-path-ㄨ")] + public async Task DebugLazyLoadedAssemblyWithPdb(string assembly_name) { Task bpResolved = WaitForBreakpointResolvedEvent(); int line = 9; await SetBreakpoint(".*/lazy-debugger-test.cs$", line, 0, use_regex: true); await LoadAssemblyDynamically( - Path.Combine(DebuggerTestAppPath, "lazy-debugger-test.dll"), - Path.Combine(DebuggerTestAppPath, "lazy-debugger-test.pdb")); + Path.Combine(DebuggerTestAppPath, $"{assembly_name}.dll"), + Path.Combine(DebuggerTestAppPath, $"{assembly_name}.pdb")); - var source_location = "dotnet://lazy-debugger-test.dll/lazy-debugger-test.cs"; + var source_location = $"dotnet://{assembly_name}.dll/lazy-debugger-test.cs"; Assert.Contains(source_location, scripts.Values); await bpResolved; var pause_location = await EvaluateAndCheck( - "window.setTimeout(function () { invoke_static_method('[lazy-debugger-test] LazyMath:IntAdd', 5, 10); }, 1);", + "window.setTimeout(function () { invoke_static_method('[" + assembly_name + "] LazyMath:IntAdd', 5, 10); }, 1);", source_location, line, 8, "LazyMath.IntAdd"); var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250.csproj" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250.csproj" new file mode 100644 index 00000000000000..9b4c7a12d15077 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250.csproj" @@ -0,0 +1,36 @@ + + + true + deltascript.json + library + false + true + + false + true + + false + false + false + true + + + true + + + + + + + + + + + + diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody0.cs" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody0.cs" new file mode 100644 index 00000000000000..833ac95a642f02 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody0.cs" @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System; + +namespace ApplyUpdateReferencedAssembly +{ + public class MethodBodyUnchangedAssembly { + public static string StaticMethod1 () { + Console.WriteLine("original"); + return "ok"; + } + } +} diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1.cs" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1.cs" new file mode 100644 index 00000000000000..3abc1d4b538bb7 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1.cs" @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System; +//keep the same line number for class in the original file and the updates ones +namespace ApplyUpdateReferencedAssembly +{ + public class MethodBody1 { + public static string StaticMethod1 () { + Console.WriteLine("original"); + int a = 10; + Debugger.Break(); + return "OLD STRING"; + } + } + + public class MethodBody2 { + public static string StaticMethod1 () { + Console.WriteLine("original"); + int a = 10; + Debugger.Break(); + return "OLD STRING"; + } + } + + public class MethodBody3 { + public static string StaticMethod3 () { + int a = 10; + Console.WriteLine("original"); + return "OLD STRING"; + } + } + + + + public class MethodBody4 { + public static void StaticMethod4 () { + } + } + + + + + + + public class MethodBody5 { + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a line that will not be changed"); + Console.WriteLine("original"); + } + } + + public class MethodBody6 { + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a line that will not be changed"); + Console.WriteLine("original"); + } + } +} diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v1.cs" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v1.cs" new file mode 100644 index 00000000000000..cef3214d9c89e9 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v1.cs" @@ -0,0 +1,87 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System; +//keep the same line number for class in the original file and the updates ones +namespace ApplyUpdateReferencedAssembly +{ + public class MethodBody1 { + public static string StaticMethod1 () { + Console.WriteLine("v1"); + double b = 15; + Debugger.Break(); + return "NEW STRING"; + } + } + + public class MethodBody2 { + public static string StaticMethod1 () { + Console.WriteLine("original"); + int a = 10; + Debugger.Break(); + return "OLD STRING"; + } + } + + public class MethodBody3 { + public static string StaticMethod3 () { + float b = 15; + Console.WriteLine("v1"); + return "NEW STRING"; + } + } + + + + public class MethodBody4 { + public static void StaticMethod4 () { + int a = 10; + int b = 20; + Console.WriteLine(a + b); + Console.WriteLine(a + b); + Console.WriteLine(a + b); + } + } + + public class MethodBody5 { + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a line that will not be changed"); + Console.WriteLine("beforeoriginal"); + Console.WriteLine("original"); + } + } + public class MethodBody6 { + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a line that will not be changed"); + Console.WriteLine("original"); + } + public static void NewMethodStatic () { + int i = 20; + newStaticField = 10; + Console.WriteLine($"add a breakpoint in the new static method, look at locals {newStaticField}"); + /*var newvar = new MethodBody6(); + newvar.NewMethodInstance (10);*/ + } + public static int newStaticField; + } + + public class MethodBody7 { + public static int staticField; + int attr1; + string attr2; + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a method in a new class"); + Console.WriteLine("original"); + MethodBody7 newvar = new MethodBody7(); + staticField = 80; + newvar.InstanceMethod(); + } + public void InstanceMethod () { + int aLocal = 50; + attr1 = 15; + attr2 = "20"; + Console.WriteLine($"add a breakpoint the instance method of the new class"); + } + } +} diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v2.cs" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v2.cs" new file mode 100644 index 00000000000000..48c3b9911e8059 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/MethodBody1_v2.cs" @@ -0,0 +1,106 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; +using System; +//keep the same line number for class in the original file and the updates ones +namespace ApplyUpdateReferencedAssembly +{ + public class MethodBody1 { + public static string StaticMethod1 () + { + Console.WriteLine("v2"); + bool c = true; + Debugger.Break(); + return "NEWEST STRING"; + } + } + + public class MethodBody2 { + public static string StaticMethod1 () { + Console.WriteLine("original"); + int a = 10; + Debugger.Break(); + return "OLD STRING"; + } + } + + public class MethodBody3 { + public static string StaticMethod3 () { + bool c = true; + int d = 10; + int e = 20; + int f = 50; + return "NEWEST STRING"; + } + } + + public class MethodBody4 { + public static void StaticMethod4 () { + } + } + + + + + + + public class MethodBody5 { + public static void StaticMethod1 () { + Console.WriteLine("beforeoriginal"); + Console.WriteLine("original"); + } + } + + public class MethodBody6 { + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a line that will not be changed"); + Console.WriteLine("original"); + } + public static void NewMethodStatic () { + int i = 20; + newStaticField = 10; + Console.WriteLine($"add a breakpoint in the new static method, look at locals {newStaticField}"); + /*var newvar = new MethodBody6(); + newvar.NewMethodInstance (10);*/ + } + public static int newStaticField; + } + + public class MethodBody7 { + public static int staticField; + int attr1; + string attr2; + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a method in a new class"); + Console.WriteLine("original"); + MethodBody7 newvar = new MethodBody7(); + staticField = 80; + newvar.InstanceMethod(); + } + public void InstanceMethod () { + int aLocal = 50; + attr1 = 15; + attr2 = "20"; + Console.WriteLine($"add a breakpoint the instance method of the new class"); + } + } + + public class MethodBody8 { + public static int staticField; + int attr1; + string attr2; + public static void StaticMethod1 () { + Console.WriteLine("breakpoint in a method in a new class"); + Console.WriteLine("original"); + MethodBody8 newvar = new MethodBody8(); + staticField = 80; + newvar.InstanceMethod(); + } + public void InstanceMethod () { + int aLocal = 50; + attr1 = 15; + attr2 = "20"; + Console.WriteLine($"add a breakpoint the instance method of the new class"); + } + } +} diff --git "a/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/deltascript.json" "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/deltascript.json" new file mode 100644 index 00000000000000..8e738364bc7475 --- /dev/null +++ "b/src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssemblyChineseCharInPath\343\204\250/deltascript.json" @@ -0,0 +1,7 @@ +{ + "changes": [ + {"document": "MethodBody1.cs", "update": "MethodBody1_v1.cs"}, + {"document": "MethodBody1.cs", "update": "MethodBody1_v2.cs"}, + ] +} + diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj index 40c0b39df330c1..c6977c5f2d0407 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj @@ -20,6 +20,7 @@ + @@ -30,6 +31,7 @@ <_AssemblyForDynamicLoading Include="lazy-debugger-test" /> + <_AssemblyForDynamicLoading Include="lazy-debugger-test-chinese-char-in-path-ㄨ" /> <_AssemblyForDynamicLoading Include="debugger-test-with-full-debug-type" /> <_AssemblyForDynamicLoading Include="debugger-test-with-pdb-deleted" /> <_AssemblyForDynamicLoading Include="debugger-test-without-debug-symbols" /> @@ -80,6 +82,9 @@ + + diff --git "a/src/mono/wasm/debugger/tests/lazy-debugger-test-chinese-char-in-path-\343\204\250/lazy-debugger-test.cs" "b/src/mono/wasm/debugger/tests/lazy-debugger-test-chinese-char-in-path-\343\204\250/lazy-debugger-test.cs" new file mode 100644 index 00000000000000..2da3c708e85acb --- /dev/null +++ "b/src/mono/wasm/debugger/tests/lazy-debugger-test-chinese-char-in-path-\343\204\250/lazy-debugger-test.cs" @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +public partial class LazyMath +{ + public static int IntAdd(int a, int b) + { + int c = a + b; + return c; + } +} + +namespace DebuggerTests +{ + public class ClassToCheckFieldValue + { + public int valueToCheck; + public ClassToCheckFieldValue() + { + valueToCheck = 20; + } + } +} From 24db1adf4ae24526ad185800bfa6b4207fd4fee1 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 26 Aug 2022 21:30:31 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Update=20src/mono/wasm/debugger/tests/debug?= =?UTF-8?q?ger-test-chinese-char-in-path-=E3=84=A8/debugger-test-chinese-c?= =?UTF-8?q?har-in-path-=E3=84=A8.csproj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../debugger-test-chinese-char-in-path-\343\204\250.csproj" | 1 + 1 file changed, 1 insertion(+) diff --git "a/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" index d75d7cd720ac04..1463b4a398f1f7 100644 --- "a/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" +++ "b/src/mono/wasm/debugger/tests/debugger-test-chinese-char-in-path-\343\204\250/debugger-test-chinese-char-in-path-\343\204\250.csproj" @@ -1,5 +1,6 @@ + false