Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

### Fixed
* Surface FSI evaluation failures to stderr by default in `FsiEvaluator`. Previously, when a code snippet failed during `--eval`, the error was silently discarded unless the caller subscribed to `EvaluationFailed` or provided an `onError` callback. Now a concise error message (file name + stderr output) is always written to stderr, making failures visible in `fsdocs` output.

### Removed
* Remove `docs/Dockerfile` (used for mybinder.org Binder integration) and mybinder badge links from documentation pages. The Binder integration relied on a deprecated .NET 7 SDK image and a deprecated `Microsoft.dotnet-interactive` version; mybinder.org support is discontinued.
* Remove `.ipynb` (Jupyter Notebook) "run in notebook" badge links from all documentation pages and delete `docs/img/badge-notebook.svg`. The links linked to `.ipynb` outputs generated by fsdocs, but .NET Interactive (which powered those notebooks) is deprecated and has no current replacement. The `.ipynb` output format itself is unchanged.
Expand Down
23 changes: 20 additions & 3 deletions src/FSharp.Formatting.Literate/Evaluator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,27 @@ module __FsiSettings =
Exception = e
StdErr = e.Result.Error.Merged }

let msg =
$"Evaluation failed and --strict is on\n file=%A{file}\n asExpression=%b{asExpression}, text=%s{text}\n stdout=%s{e.Result.Output.Merged}\n\ stderr=%s{e.Result.Error.Merged}\n inner exception=%A{e.InnerException}"
// Always surface evaluation failures to stderr so they are visible by default,
// even when the caller has not subscribed to EvaluationFailed or provided onError.
let fileInfo =
match file with
| Some f -> $" in {f}"
| None -> ""

onError msg
let stderr = e.Result.Error.Merged.Trim()

let errorMsg =
if stderr <> "" then
$"fsdocs eval: evaluation failure{fileInfo}\n{stderr}"
else
$"fsdocs eval: evaluation failure{fileInfo}\n{e.InnerException}"

eprintfn "%s" errorMsg

let strictMsg =
$"Evaluation failed\n file=%A{file}\n asExpression=%b{asExpression}, text=%s{text}\n stdout=%s{e.Result.Output.Merged}\n stderr=%s{e.Result.Error.Merged}\n inner exception=%A{e.InnerException}"

onError strictMsg

{ Output = None
FsiOutput = None
Expand Down