Skip to content

DebuggerNonUserCode attribute added incorrectly to class-nested functions #14652

@ghost

Description

With Debug builds, the F# 7 compiler (version 12.0.5.0) seems to add two attributes to all let-bound functions nested inside a class: CompilerGenerated and DebuggerNonUserCode. I believe that previously only CompilerGenerated was added. The inclusion of the DebuggerNonUserCode attribute seems to prevent VSCode and Visual Studio from setting breakpoints in these nested functions. Since the functions are clearly user code, I believe the attribute is being added incorrectly.

To reproduce, compile (dotnet build -c Debug) the attached project and use a disassembler (e.g. ilspy) to examine the code produced for the go function (nested in the Example class). It has the DebuggerNonUserCode attribute. If you then use Ionide (for example) to debug the project in VSCode, you cannot set a breakpoint in the nested go function. Expected behavior is that you can set a breakpoint in such nested functions.

FYI, I compiled (fsc -g) Program.fs with F# 11.4.2.0, and found that CompilerGenerated was present on the go function, but not DebuggerNonUserCode.

temp.zip

Metadata

Metadata

Assignees

Labels

Area-Compiler-CodeGenIlxGen, ilwrite and things at the backendBugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions