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

Q: Debug/Diagnostics Mode #762

Closed
matthid opened this issue Apr 28, 2017 · 9 comments
Closed

Q: Debug/Diagnostics Mode #762

matthid opened this issue Apr 28, 2017 · 9 comments

Comments

@matthid
Copy link
Contributor

matthid commented Apr 28, 2017

Is there currently only diagnostics / debug mode for the FCS component?

Time and time again I run into problems when using FCS and then I feel like I could use some logging or just more info what the compiler is doing instead of error FS0193: internal error: or whatever.

This doesn't need to be the default, it could be controlled by an undocumented environment variable for example.

This might be even a problem in the compiler code-base itself. But I mostly have this problems when using FCS therefore I opened the issue here.

In the past I have used custom builds like https://github.com/matthid/FSharp.Compiler.Service/commits/improve_error or https://github.com/matthid/FSharp.Compiler.Service/commits/improve_fcs_logging to help myself in such situations but this really is a frustrating experience for several reasons (one is that building this component time and time again frustrating in itself).

So my question basically is. Would a PR fixing the following issues be accepted:

  • Remove Exception Hiding -> Use Inner Exceptions to properly propagate underlying exception objects. (failwithf is really a bad choice in propagating errors)
  • Use existing logging infrastructure and allow users to plugin their own logging (or just enable it to print to stdout)

To be more concrete:

  • Which logging framework would be acceptable to use (you can see that I used .NetFrameworks TraceSource for this in my branch)?
  • Should this go against visualfsharp?
  • Any things I need to consider to get this accepted?
  • What would be the preferred way to enable such a debug/diagnostic mode?

Maybe there is already a way I was missing?

/cc @dsyme @cloudRoutine

@cloudRoutine
Copy link
Contributor

To make it easier for people to get access to a debug build we could make a package for it that's only published on an appveyor feed.

But apart from that I think we could do a lot to improve the logging and diagnostic outputs of FCS

@dsyme
Copy link
Contributor

dsyme commented Apr 28, 2017

@matthid I almost exclusively rely on either

  1. For exceptions: turning on "stop on all CLR exceptions" in the Visual Studio debugger, also turning off "Just My Code". It's frustrating that Mono doesn't appear to have a really easy-to-use equivalent, maybe I'm missing it though (I don't edit the compiler on Linux/Mac very much)

  2. For general testing: using the scripting approach in the tests\service tests

@matthid
Copy link
Contributor Author

matthid commented Apr 29, 2017

@dsyme yes I agree that's the best approach when you can reproduce the problem on your windows developer machine. This discussion is what we do in the other cases (which apparently I hit quite often for some reason)

@cloudRoutine
Copy link
Contributor

For FCS out in the wild we're up a creek without a paddle, failing CI servers, as mono is want to do, build tools failing on devs using unfamiliar setups, and if you wanted to embed F# in an app to use as a scripting language it's not particularly easy to get back useful information if things start failing.

@matthid
Copy link
Contributor Author

matthid commented Apr 29, 2017

Just a collection of issues where this issue kept ME (others possibly just resigned already, its just too hard) on my toes and would have helped me to at least produce better bug reports or find workarounds faster:

Note that some of those bug reports took me hours or days to create (often with specially customized FCS builds involved). Just because I know that reporting "I get error FS0193: internal error" is a waste of time. It really shouldn't be THAT difficult to provide a good bug report for the heart or the F# ecosystem.

Two out of those 4 are still open ...

@matthid
Copy link
Contributor Author

matthid commented Apr 29, 2017

Maybe it's enough to upload a debug build on some nuget (appveyor?) feed and document

Debug.AutoFlush <- true
Debug.Listeners.Add(new TextWriterTraceListener(System.Console.Out)) |> ignore

That would already improve the situation dramatically (IMHO). However it would only improve the situation for FCS and not the rest of the ecosystem (like Visual Studio).

I'd propose that whenever we upload a version X.Y.Z we upload a debug build X.Y.(Z+1)-alpha001 to AppVeyor (/cc @forki for the versioning suggestion). This way we don't mess with nuget cache and stuff...

@dsyme
Copy link
Contributor

dsyme commented Apr 29, 2017

I'd propose that whenever we upload a version X.Y.Z we upload a debug build X.Y.(Z+1)-alpha001 to AppVeyor (/cc @forki for the versioning suggestion). This way we don't mess with nuget cache and stuff...

That totally makes sense. Please just add the debug builds to the AppVeyor build process?

@dsyme
Copy link
Contributor

dsyme commented Apr 29, 2017

Even just a debug version of FSharp.Compiler.Serrvice and nothing else, along with PDBs.

@dsyme
Copy link
Contributor

dsyme commented May 2, 2017

Closing as fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants