Skip to content

Repl --run Output Notebook Crashes VS Code C# Language Server #88

@andy-merrick

Description

@andy-merrick

Issue Type: Bug

Description: Using --run with inputs causes the ipynb output file to crash the C# Language Server in VS Code when opening with Polyglot Notebooks v1.0.4403010 resulting in the notebook's Output cells being cleared. Possible fix below.

Command

dotnet-repl --run input.ipynb --exit-after-run --input id=1 --output-path output.ipynb

Repro Files

VS Code C# Terminal Output Error

[LanguageServerHost]System.InvalidOperationException: didOpen received for vscode-notebook-cell:/c:/Users/xxxxxxxxxxx/repos/polyglot/playground/dotnet-repl-error/dotnet-repl-output.ipynb#W1sZmlsZQ== which is already open. - line 106
   at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154
...
...

Cause

dotnet-repl writes the following json key into the output file:

"language_info": {
   "file_extension": ".cs",
   "mimetype": "text/x-csharp",
   "name": "C#",
   "pygments_lexer": "csharp",
   "version": "10.0"
},

Fix

Replacing this key with how VS Code writes it results in the dotnet-repl file successfully loading in VS Code:

"language_info": {
    "name": "polyglot-notebook"
},

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions