Closed
Description
Describe the bug
Stepping through code acts unpredictably, sometimes skipping over expressions that should be hit.
Workaround
You can guarantee that code will stop on a given line by adding a breakpoint. Because STEP OVER acts so unpredictably, adding a breakpoint is really the only way you can guarantee that your code is going to stop on a given line.
To Reproduce
- Create a new Blazor WASM project
- Add a new .NET library project to the solution
- Add the
Foo
class 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
method of theFoo
class on the line withret = 0
- Start debugging
- Click on the "Fetch Data" link in the window
- The program should break in the
Foo
class. - Press F10 (or invoke the STEP OVER VS debug command)
Expected Results
The currently executing line will progress will progress to the line with return ret;
Actual Results
The debugger steps out of the function
Foo.cs
using System;
using System.Linq;
using System.Collections.Generic;
namespace BlazorBugsLib
{
public class Foo
{
public string Lorem { get; set; } = "Safe";
public int Bar()
{
int ret;
if (Lorem.StartsWith('S'))
ret = 0;
else
ret = 1;
return ret;
}
}
}
FetchData.razor
protected override async Task OnInitializedAsync()
{
Console.WriteLine(new BlazorBugsLib.Foo().Bar());
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("Bad URI");
}