-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[wasm][debugger] Implement support to DebuggerDisplay attribute #55524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thaystg
merged 6 commits into
dotnet:main
from
thaystg:thays_support_debugger_custom_views
Jul 14, 2021
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
107ccd8
Support DebuggerDisplay attribute on type.
thaystg a8fb8cf
Merge branch 'main' of github.com:thaystg/runtime into thays_support_…
thaystg 58c0108
Implementing DebuggerDisplay calling methods.
thaystg fa91a1e
Apply suggestions from code review
thaystg c55c8b0
Fixing snake case.
thaystg 7c64b5d
Changing snake case.
thaystg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Support DebuggerDisplay attribute on type.
- Loading branch information
commit 107ccd8a601ce5ea9ed1cf495dbe9ce257dfe4d1
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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"); | ||
| } | ||
| } | ||
| } |
73 changes: 73 additions & 0 deletions
73
src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs
This file contains hidden or 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))] | ||
thaystg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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}")] | ||
thaystg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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); | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.