Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp;
using System.Reflection;
using System.Text;

namespace Microsoft.WebAssembly.Diagnostics
{
Expand Down Expand Up @@ -397,9 +398,10 @@ internal static unsafe void PutBytesBE (byte *dest, byte *src, int count)
public override string ReadString()
{
var valueLen = ReadInt32();
char[] value = new char[valueLen];
byte[] value = new byte[valueLen];
Read(value, 0, valueLen);
return new string(value);

return new string(Encoding.UTF8.GetChars(value, 0, valueLen));
}
public unsafe long ReadLong()
{
Expand Down
6 changes: 4 additions & 2 deletions src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CustomViewTests : DebuggerTestBase
[Fact]
public async Task UsingDebuggerDisplay()
{
var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 12);
var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 15);
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",
Expand All @@ -29,12 +29,14 @@ public async Task UsingDebuggerDisplay()
CheckObject(locals, "a", "DebuggerTests.WithDisplayString", description:"Some one Value 2 End");
CheckObject(locals, "c", "DebuggerTests.DebuggerDisplayMethodTest", description: "First Int:32 Second Int:43");
CheckObject(locals, "myList", "System.Collections.Generic.List<int>", description: "Count = 4");
CheckObject(locals, "person1", "DebuggerTests.Person", description: "FirstName: Anton, SurName: Mueller, Age: 44");
CheckObject(locals, "person2", "DebuggerTests.Person", description: "FirstName: Lisa, SurName: Müller, Age: 41");
}

[Fact]
public async Task UsingDebuggerTypeProxy()
{
var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 12);
var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 15);
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ string GetDebuggerDisplay ()
}
}

[DebuggerDisplay("FirstName: {FirstName}, SurName: {SurName}, Age: {Age}")]
public class Person {
public string FirstName { get; set; }
public string SurName { get; set; }
public int Age { get; set; }
}

class DebuggerCustomViewTest
{
public static void run()
Expand All @@ -73,6 +80,9 @@ public static void run()
openWith.Add("txt", "notepad");
openWith.Add("bmp", "paint");
openWith.Add("dib", "paint");
var person1 = new Person { FirstName = "Anton", SurName="Mueller", Age = 44};
var person2 = new Person { FirstName = "Lisa", SurName="Müller", Age = 41};

Console.WriteLine("break here");

Console.WriteLine("break here");
Expand Down