Skip to content

Debugger attaching too late - Unable to hit breakpoints in Startup.cs #1971

@TroyWitthoeft

Description

@TroyWitthoeft

In some situations, it looks like the VS Code debugger is unable to attach fast enough to hit specific breakpoints. For example, if we create a boilerplate C# httptriggered Azure function and add a startup.cs file those "early" breakpoints in the file are often missed. Example repo - https://github.com/TroyWitthoeft/AzureFunctionsHostStartupBug

Example of missed breakpoint

76422092-09841600-637b-11ea-863f-e04c2cdf06ef

Above, why didn't we hit the first breakpoint?
Is there anything we can do to correct this? I've had quite a few dev's trying to get started with DI in C# using startup.cs and having this issue.

Note, I am posting here on the suggestion of @WardenGnaw who is assisting me in the csharp extension repo at issue 3644. He mentioned that your team might be able to assist.

Thoughts... Is it possible to change the launch.json file or the ${command:azureFunctions.pickProcess} command to correct for this? Is there someway we can signal to the debugger that we are ready for it to attach?

Environment

VSCode = 1.43.0
Azure Functions Extension = 0.21.0
csharp extension = 1.21.12
azure functions core tools = 3.0.2245

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.1.102
 Commit:    573d158fea

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.102\

Host (useful for support):
  Version: 3.1.2
  Commit:  916b5cba26

.NET Core SDKs installed:
  3.1.101 [C:\Program Files\dotnet\sdk]
  3.1.102 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions