dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.89k stars 783 forks source link

TMI when passing an invalid commandline option to FSI.exe #9986

Closed abelbraaksma closed 5 months ago

abelbraaksma commented 4 years ago

We show a full stacktrace whenever you pass a wrong commandline option. That isn't very neat, I think we ought to just print the error instead.

This is current:

error FS0243: Unrecognized option: '--version'

Exception by fsi.exe:
System.Exception: Error creating evaluation session: StopProcessingExn None
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1639.Invoke(String message)
   at FSharp.Compiler.Interactive.Shell.FsiCommandLineOptions..ctor(FsiEvaluationSessionHostConfig fsi, String[] argv, TcConfigBuilder tcConfigB, FsiConsoleOutput fsiConsoleOutput)
   at FSharp.Compiler.Interactive.Shell.FsiEvaluationSession..ctor(FsiEvaluationSessionHostConfig fsi, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, Boolean fsiCollectible, FSharpOption`1 legacyReferenceResolver)
   at FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.Create(FsiEvaluationSessionHostConfig fsiConfig, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, FSharpOption`1 collectible, FSharpOption`1 legacyReferenceResolver)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Sample.FSharp.Compiler.Interactive.Main.evaluateSession(String[] argv)

Expected:

error FS0243: Unrecognized option: '--version'

Or even better, we can dump the --help screen whenever an invalid commandline is passed, or a simple line saying "use --help for help".

cartermp commented 4 years ago

Yep, this can be improved

KevinRansom commented 4 years ago

You know, nearly every time I see the error trace, I think, dang we should fix that. Then get back to work.

abelbraaksma commented 5 months ago

@vzarytovskii, you moved this to Not planned, but it has meanwhile been fixed 🥳 . I'll adjust status accordingly. Screenshot is from current RTM.

image

vzarytovskii commented 5 months ago

Sure, but please don't add or change any impact labels, those are for internal use only.