Omnisharp-vscode: Debugging f# on .net core

Created on 21 Feb 2017  路  17Comments  路  Source: OmniSharp/omnisharp-vscode

ref https://github.com/ionide/ionide-vscode-fsharp/issues/366

I'd like to support debugging of .net core f# apps. That app will generate portable pdb, and is built with latest released f# .net core compiler (fsc)

Doing some tests, it works sort of,

image

Repro:

launch.fs is the one generated by omnisharp

What works?

  • stop on exception
  • eval/locals (c# style)
  • breakpoints require dev version of ionide
  • nested functions (need a new repro, but just extract failwith in a function) require dev version of ionide

What doesnt work

  • eval f# style

Some guidance from debugger team on how add debugger breakpoints? It's something the vs extension ionide https://github.com/ionide/ionide-vscode-fsharp should do?

Thanks to @DustinCampbell @filipw for help.

/cc @KevinRansom @cartermp @Krzysztof-Cieslak

Environment data

dotnet --info output: 1.0.0-rc4-004771
VS Code version: 1.9.1
C# Extension version: 1.7.0
F# Ionide Extension version: 2.22.3

Debugger

Most helpful comment

@gregg-miskelly @DustinCampbell as a note, thx a lot for support.

now F# works ootb (ionide obv) with dotnet new -> dotnet restore -> intellisense! -> F5 -> debug!

with packagererences, projectreferences etc 馃槃

recf-ionide2

All 17 comments

cc @gregg-miskelly

some info about portablepdb and breakpoint from @filipw : https://github.com/dotnet/roslyn/pull/16489#discussion_r96521263 to not lose it :D

Some progress thanks to @Krzysztof-Cieslak

If i add mono-debugger extension, breakpoint magically start to work for .net core debugger too.
Checking source code, mono-debugger enable breakpoints checking the filename extension

So where is the code who does that for c# in .net core debugger? a similar fix maybe is enough.

related, also unity debugger work like mono-debugger but doesnt enable f# extensions

More progress. breakpoints works, steps too

debug-breakpoints

Added to package.json to enable breakpoints

     "breakpoints": [
        {
          "language": "fsharp"
        }
      ]

But review/feedback from debugger team will be nice to have

@enricosada that sounds correct that you would add 'fsharp' under breakpoint languages in package.json.

@enricosada does this issue track anything else, or should I close it?

@enricosada I am closing this for now. But feel free to ping back and/or open a new issue if there is more that we can try and help with.

Thank @gregg-miskelly i think can be closed too, sry for late reply. Debugging will works ok with f#.

I didnt had the opportunity to reach the debugger team yet (i have no points of contact atm because i dont know who they are) to have come clarification about how to improve things (like eval), etc. will try other ways (suggestion welcome :D)

But is ok :D, thx for help!

@enricosada the debugger team is my team. You can open issues here and we will see them.

For supporting F# expressions - someone would need to develop an F# expression evaluator. There is a sample expression evaluator on https://github.com/Microsoft/ConcordExtensibilitySamples/wiki/Managed-Expression-Evaluator-Sample. It used to be really hard to make a good EE, so the F# team and community never tried to make one (to my knowledge at least). It is certainly not something that someone is going to bang out in a week, but it is way easier than it used to be, so it would be great if someone from the team or community took that on. We are happy to provide some assistance in getting started / when folks get stuck. But it isn't something we have the resources or F# expertise to implement ourselves. Our model is that we provide the language-neutral infrastructure and language teams write the language-specific portions.

Sorry Gregg, i confused your reply because in this repo.
I also didnt check the teams list on dotnet org (but that is visibile only if logged, uops two times)
So my bad.

Our model is that we provide the language-neutral infrastructure and language teams write the language-specific portions

Perfect for me, i like that. if is language neutral by default, is easier to add other langs like f#. When is c# first and extensibility is added instead is a pain (just an example the lang, is valid for all extensible tools)

We are happy to provide some assistance in getting started / when folks get stuck. But it isn't something we have the resources or F# expertise to implement ourselves

I think that's enough, can be done by F# community, just need a bit of guidance/pointers at start. and the repo you linked is a really good start. The real hard part is to find info to start 馃槃

@gregg-miskelly added https://github.com/Microsoft/visualfsharp/issues/2544 to track f# evaluator, if someone in community want to try implement that. Thx a lot another time!

@gregg-miskelly @DustinCampbell as a note, thx a lot for support.

now F# works ootb (ionide obv) with dotnet new -> dotnet restore -> intellisense! -> F5 -> debug!

with packagererences, projectreferences etc 馃槃

recf-ionide2

Very nice! cc @cartermp

@enricosada Very cool!

Huge work @enricosada!

If anyone finds themselves here wondering why you keep getting errors while trying to debug, make sure you pay attention to the error message. I had to download the .Net Core debugger to get this to work.

Ctrl + P to open the command palette then type

> Debug: Download Download .NET Core Debugger
Was this page helpful?
0 / 5 - 0 ratings

Related issues

slevengood picture slevengood  路  3Comments

hamhub7 picture hamhub7  路  3Comments

jrmcdona picture jrmcdona  路  3Comments

tstivers1990 picture tstivers1990  路  3Comments

ghost picture ghost  路  3Comments