Skip to content
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

Watch window does not execute ToString() on objects #49143

Closed
RobertBouillon opened this issue Mar 3, 2021 · 7 comments · Fixed by #55915
Closed

Watch window does not execute ToString() on objects #49143

RobertBouillon opened this issue Mar 3, 2021 · 7 comments · Fixed by #55915
Assignees
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Milestone

Comments

@RobertBouillon
Copy link

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

  1. Create a new Blazor WASM project
  2. Add a new .NET library project to the solution
  3. Add the Foo and Something classes to the library with the code below
  4. Add a reference to the .NET library project from the WASM project
  5. Update the FetchData.razor page with the code below.
  6. Add a breakpoint in the Bar property
  7. Start debugging
  8. Click on the "Fetch Data" link in the window
  9. 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
(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)
image

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);
  }
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Mar 4, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 4, 2021
@ghost
Copy link

ghost commented Mar 4, 2021

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

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

  1. Create a new Blazor WASM project
  2. Add a new .NET library project to the solution
  3. Add the Foo and Something classes to the library with the code below
  4. Add a reference to the .NET library project from the WASM project
  5. Update the FetchData.razor page with the code below.
  6. Add a breakpoint in the Bar property
  7. Start debugging
  8. Click on the "Fetch Data" link in the window
  9. 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
(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)
image

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);
  }
Author: RobertBouillon
Assignees: -
Labels:

area-Debugger-mono, untriaged

Milestone: -

@mkArtakMSFT mkArtakMSFT added the arch-wasm WebAssembly architecture label Mar 4, 2021
@ghost
Copy link

ghost commented Mar 4, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

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

  1. Create a new Blazor WASM project
  2. Add a new .NET library project to the solution
  3. Add the Foo and Something classes to the library with the code below
  4. Add a reference to the .NET library project from the WASM project
  5. Update the FetchData.razor page with the code below.
  6. Add a breakpoint in the Bar property
  7. Start debugging
  8. Click on the "Fetch Data" link in the window
  9. 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
(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)
image

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);
  }
Author: RobertBouillon
Assignees: -
Labels:

arch-wasm, area-Debugger-mono, untriaged

Milestone: -

@lewing
Copy link
Member

lewing commented Mar 5, 2021

cc @radical

@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Mar 5, 2021
@RobertBouillon
Copy link
Author

I just realized I can't execute ToString at all, even explicitly. Is this related, or should I log a different issue?
image

@radical
Copy link
Member

radical commented Mar 9, 2021

It doesn't support calling any methods yet (#45596).

@SamMonoRT SamMonoRT added this to the 6.0.0 milestone Jun 23, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 19, 2021
@thaystg
Copy link
Member

thaystg commented Jul 19, 2021

It's working.

@thaystg thaystg closed this as completed Jul 19, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 21, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants