Skip to content

Blazor WASM "step over" doesn't work properly for referenced assemblies #49142

Closed
@RobertBouillon

Description

@RobertBouillon

Describe the bug

Pressing F10 (Step Over) when debugging a WASM project doesn't always step over the current expression. This can be frustrating when debugging because the STEP OVER command acts unpredictably

To Reproduce

  1. Create a new Blazor WASM project
  2. Add a new .NET library project to the solution
  3. Add the Foo class 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 method of the Foo class where var d is defined.
  7. Start debugging
  8. Click on the "Fetch Data" link in the window
  9. The program should break on the breakpoint added in step 6
  10. Press F10 (or otherwise select STEP OVER in VS)

Expected Results

The current executing line of code should progress to the following line with Console.WriteLine

Actual Results

The current executing line of code remains on the current line and requires a second press to continue as expected.

Notes

This only appears to affect code in referenced assemblies. If the body of Bar is copied to OnInitializedAsync, STEP OVER behaves as expected. Upon deeper investigation, it appears that the operands of && are being treated as separate lines of code when debugged from the referenced library.

Foo Class

public class Foo
{
    public void Bar()
    {
      var a = 1;
      var b = 2;
      var x = "Stew";
      var y = "00.123";
      var c = a + b == 3 || b + a == 2;
      var d = TimeSpan.TryParseExact(y, @"ss\.fff", null, out var ts) && x.Contains('S');
      Console.WriteLine(d);
    }

FetchData.razor

  protected override async Task OnInitializedAsync()
  {
    new BlazorBugsLib.Foo().Bart();
    forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("Bad URI");
  }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions