Closed
Description
Describe the bug
The watch window doesn't execute the ToString()
method in Blazor WASM, which is valuable in debugging to inspect identifying properties of an object without having to expand it, especially when the objects are members of a collection.
To Reproduce
- Create a new Blazor WASM project
- Add a new .NET library project to the solution
- Add the
Foo
andSomething
classes to the library with the code below - Add a reference to the .NET library project from the WASM project
- Update the
FetchData.razor
page with the code below. - Add a breakpoint in the
Bar
property - Start debugging
- Click on the "Fetch Data" link in the window
- The program should break in the
Foo
class. Open the locals Window
Expected Results
The What
property shows the result of ToString
(Name of Something
)
(Image shown is the locals window when the same value is viewed from a console project)
Actual Results
The What
property shows the name of the type (BlazorBugsLib.Something
)
Foo.cs
using System;
namespace BlazorBugsLib
{
public class Foo
{
public string Bar => "sample-data/weather.json";
public string Lorem { get; set; } = "Safe";
public string Ipsum { get; set; } = "Side";
public Something What { get; } = new Something();
}
public class Something
{
public string Name { get; set; }
public Something() => Name = "Name of something";
public override string ToString() => Name;
}
}
FetchData.razor
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>(new BlazorBugsLib.Foo().Bar);
}