You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't use online tool in this case cause this is not reproducible there.
Using v4.4.0-alpha-007 I found a case in which fantomas was not able to format the file (will file that source-code problem separately), throwing this:
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
at Fantomas.CodeFormatterImpl.isValidFSharpCode@378-7.Invoke(AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322
Processing ./NodeEffect.Server/Handlers/NodeEffectHandler.fs
./NodeEffect.Server/Handlers/NodeEffectHandler.fs has been written.
Processing ./NodeEffect.Server/Handlers/WatcherHandler.fs
The following exception occurs while formatting stdin: Fantomas.FormatConfig+FormatException: Formatted content is not valid F# code
at Fantomas.Extras.FakeHelpers.formatContentInternalAsync@95-5.Invoke(Boolean _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Extras\FakeHelpers.fs:line 96
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
at Fantomas.CodeFormatterImpl.isValidFSharpCode@378-7.Invoke(AsyncActivation`1 ctxt) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 378
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
at Microsoft.FSharp.Control.AsyncResult`1.Commit() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 870
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 878
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1142
at Program.processSourceString(Boolean isFsiFile, String s, FSharpChoice`2 tw, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 113
at Program.stringToFile@310(Boolean force, Boolean profile, String s, String outFile, FormatConfig config) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.CoreGlobalTool\Program.fs:line 322
However, the exit code was still zero, which can then not be picked up by CI pipelines, for example.
The text was updated successfully, but these errors were encountered:
Hello @knocte, thank you for reporting this issue.
I believe a test in Fantomas.CoreGlobalTool.Tests might be able to reproduce this problem.
Would you be interested in submitting a PR for this problem?
@nojaf are you sure this can be converted into a test? I mean, I could add a new code snippet in CheckTests.fs, with the minimal testcase that I found to be reproducing this problem there. However, as I said before:
will file that source-code problem separately
As soon as I file that new bug, and it gets fixed in fantomas, then the test for this bug would begin to fail (because this time it would manage to format the file and the exit code would start to be zero).
I think this is one of this cases in which a test cannot be written, and it just needs to be fixed in the source, and tested manually.
Can't use online tool in this case cause this is not reproducible there.
Using v4.4.0-alpha-007 I found a case in which fantomas was not able to format the file (will file that source-code problem separately), throwing this:
However, the exit code was still zero, which can then not be picked up by CI pipelines, for example.
The text was updated successfully, but these errors were encountered: