When you have complex projects where simple F# Interactive and printing is not enough, it is also possible to attach a debugger to F# projects - note that this feature is only supported in F# project files (.fs) and not F# script files (.fsx)

To do this, first create a F# console project.

dotnet new console --language F#

Then, open the project in your preferred editor:

Visual Studio Code

In Visual Studio Code you can debug projects with the "F#: Debug Default Project" command. (note: this is not the default F5 debug command, you need to use the command palette to find it or configure a keybinding)

Visual Studio Code

Rider

In Rider, you can debug F# projects by setting breakpoints and running the project in debug mode.

Visual Studio Code