Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support F# expression in debugger eval #2544

Open
enricosada opened this issue Mar 7, 2017 · 8 comments
Open

Support F# expression in debugger eval #2544

enricosada opened this issue Mar 7, 2017 · 8 comments
Assignees
Labels
Area-Debug stepping, debug points, stacks and more Feature Request
Milestone

Comments

@enricosada
Copy link
Contributor

To support F# expressions in debugger eval (watch/etc) need an F# expression evaluator

A sample evaluator https://github.com/Microsoft/ConcordExtensibilitySamples/wiki/Managed-Expression-Evaluator-Sample

As per info by @gregg-miskelly (debugger team) in dotnet/vscode-csharp#1257 (comment) i quote directly because good ihmo (is already language agnostic, easier to do than before, debugger team may assist a bit to start)

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.

@cartermp cartermp added Area-Debug stepping, debug points, stacks and more Feature Request labels Mar 7, 2017
@cartermp cartermp added this to the vFuture milestone Mar 7, 2017
@cartermp
Copy link
Contributor

cartermp commented Mar 7, 2017

Tagging - we're still in the process of figuring out things internal w.r.t teams and what they're working on, but this is something we care deeply about and will be looking at. Just a note, it's a considerable amount of work. A proper EE for F# will take time to complete and get right.

@KevinRansom
Copy link
Member

@enricosada An F# aware EE would be a fantastic thing ... with the roslyn EE it may not be quite the humongous work-item it would have been in the past.

We are working through what it would take to make this happen internally, or what it would take to enable the OSS community to drive it.

Kevin

@saul
Copy link
Contributor

saul commented Mar 7, 2017

Gregg's comment is promising. Looking at the API it doesn't look like it would be insanely difficult - considering some of the Roslyn features that have been written from scratch over the past few months this should be simple :p

@enricosada
Copy link
Contributor Author

I just logged this as todo because the sample is really well documented. Can be useful later

@dsyme
Copy link
Contributor

dsyme commented Mar 8, 2017

We should consider what the necessary entry point to the F# compiler service is. The signature needed will be something like this:

FSharpProjectOptions * fileInProject:string * locationInFile: Position* expressionText:string -> FSharpExpr

though some additional context may be needed to bind names, work out NameResolutionEnvironment etc. Walking FSharpExpr and doing evaluation is likely not too hard.

@dsyme
Copy link
Contributor

dsyme commented Aug 24, 2021

For future reference: the C#/VB expression evaluator is here: https://github.com/dotnet/roslyn/tree/main/src/ExpressionEvaluator

@dsyme
Copy link
Contributor

dsyme commented Aug 24, 2021

Chat with @tmat

[21:33] Don Syme
A while back I wrote an interpreter for some of F# here https://github.com/fsprojects/FSharp.Compiler.PortaCode, sitting on top of FSharp.Compiler.Service.  Perhaps that's the core of what's needed

[21:34] Tomas Matousek
The debugger has IL interpreter used for EEs. F# shouldn't need a custom one.

[21:34] Don Syme
I see, so it's an Expression -> IL compiler

[21:35] Tomas Matousek
Kind of. It's not really limited to expressions. That's just C# limitation.

[21:35] Don Syme
What if classes are needed for a construct (lambdas, object expressions etc)?

[21:35] Tomas Matousek
You can compile any code. The result is an assembly that gets interpreted.

[21:36] Tomas Matousek
Yes, that's allowed.

[21:36] Don Syme
Ah ok, is the assembly dynamically disposed?  Also is it out of proc with C#?

[21:36] Tomas Matousek
The assembly has a well-known entry point that the debugger runs

[21:36] Tomas Matousek
Currently in-proc.

@gregg-miskelly
Copy link

@dsyme For more information, the EE documentation is here

@abonie abonie added this to the July-2023 milestone Jul 6, 2023
@abonie abonie self-assigned this Jul 6, 2023
@NatElkins NatElkins mentioned this issue Sep 1, 2023
@abonie abonie modified the milestones: July-2023, September-2023 Sep 7, 2023
@abonie abonie modified the milestones: September-2023, October-2023 Oct 4, 2023
@vzarytovskii vzarytovskii reopened this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debug stepping, debug points, stacks and more Feature Request
Projects
Archived in project
Development

No branches or pull requests

8 participants