-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm][debugger] Implement support to DebuggerDisplay attribute (#55524)
* Support DebuggerDisplay attribute on type. * Implementing DebuggerDisplay calling methods. * Apply suggestions from code review Co-authored-by: Larry Ewing <lewing@microsoft.com> * Fixing snake case. * Changing snake case. Co-authored-by: Larry Ewing <lewing@microsoft.com>
- Loading branch information
Showing
8 changed files
with
271 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.WebAssembly.Diagnostics; | ||
using Newtonsoft.Json.Linq; | ||
using System.Threading; | ||
using Xunit; | ||
|
||
namespace DebuggerTests | ||
{ | ||
|
||
public class CustomViewTests : DebuggerTestBase | ||
{ | ||
[Fact] | ||
public async Task CustomView() | ||
{ | ||
var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 5); | ||
var pause_location = await EvaluateAndCheck( | ||
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.DebuggerCustomViewTest:run'); }, 1);", | ||
"dotnet://debugger-test.dll/debugger-custom-view-test.cs", | ||
bp.Value["locations"][0]["lineNumber"].Value<int>(), | ||
bp.Value["locations"][0]["columnNumber"].Value<int>(), | ||
"run"); | ||
|
||
var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value<string>()); | ||
CheckObject(locals, "a", "DebuggerTests.WithDisplayString", description:"Some one Value 2 End"); | ||
CheckObject(locals, "c", "DebuggerTests.DebuggerDisplayMethodTest", description: "First Int:32 Second Int:43"); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
// 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.Threading.Tasks; | ||
using System.Diagnostics; | ||
|
||
namespace DebuggerTests | ||
{ | ||
[DebuggerDisplay("Some {Val1} Value {Val2} End")] | ||
class WithDisplayString | ||
{ | ||
internal string Val1 = "one"; | ||
|
||
public int Val2 { get { return 2; } } | ||
} | ||
|
||
class WithToString | ||
{ | ||
public override string ToString () | ||
{ | ||
return "SomeString"; | ||
} | ||
} | ||
|
||
[DebuggerTypeProxy(typeof(TheProxy))] | ||
class WithProxy | ||
{ | ||
public string Val1 { | ||
get { return "one"; } | ||
} | ||
} | ||
|
||
class TheProxy | ||
{ | ||
WithProxy wp; | ||
|
||
public TheProxy (WithProxy wp) | ||
{ | ||
this.wp = wp; | ||
} | ||
|
||
public string Val2 { | ||
get { return wp.Val1; } | ||
} | ||
} | ||
|
||
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")] | ||
class DebuggerDisplayMethodTest | ||
{ | ||
int someInt = 32; | ||
int someInt2 = 43; | ||
|
||
string GetDebuggerDisplay () | ||
{ | ||
return "First Int:" + someInt + " Second Int:" + someInt2; | ||
} | ||
} | ||
|
||
class DebuggerCustomViewTest | ||
{ | ||
public static void run() | ||
{ | ||
var a = new WithDisplayString(); | ||
var b = new WithProxy(); | ||
var c = new DebuggerDisplayMethodTest(); | ||
Console.WriteLine(a); | ||
Console.WriteLine(b); | ||
Console.WriteLine(c); | ||
} | ||
} | ||
} |