Omnisharp-vscode: 1.6.0: Extension host terminated unexpectedly. Please reload the window to recover.

Created on 22 Dec 2016  路  15Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64

VS Code version:
1.8.1
C# Extension version:
1.6.0

Steps to reproduce

Open a C# file. Omnisharp is starting up and when it's almost finished: "Extension host terminated unexpectedly. Please reload the window to recover."

Expected behavior

No crash and a working C# environment. I don't see an exception in the Omnisharp log. It ends with:

[INFORMATION:OmniSharp#MSBuild] MSBUILD_EXE_PATH environment variable set to /Users/tverboon/.vscode/extensions/ms-vscode.csharp-1.6.0/bin/omnisharp/msbuild/MSBuild.dll
[INFORMATION:OmniSharp#MSBuild] MSBuildExtensionsPath environment variable set to /Users/tverboon/.vscode/extensions/ms-vscode.csharp-1.6.0/bin/omnisharp/msbuild
[INFORMATION:OmniSharp#MSBuild] MSBuildSDKsPath environment variable set to /Users/tverboon/.vscode/extensions/ms-vscode.csharp-1.6.0/bin/omnisharp/msbuild/Sdks
[INFORMATION:OmniSharp#MSBuild] No solution files found in '/Users/tverboon/Desktop/Code/Midmid'
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Detecting CSX files in '/Users/tverboon/Desktop/Code/Midmid'.
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Configuration finished.

Actual behavior

"Extension host terminated unexpectedly. Please reload the window to recover." And C# is not working.


Extra info:
I did some extra testing as I had to reinstall the previous version. For me the extension causes a crash in 1.6-beta7. 1.6-beta6 and before are working.

Bug Resolved-Fixed

Most helpful comment

I found the problem. some settings corrupted in this direction :
C:Program Files (x86)Microsoft VS Code Insidersresourcesappextensions
Remove all folders and restart vs-code to fix it !!

All 15 comments

Same, with similar environment.

bash-3.2$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-1-003177)

Product Information:
 Version:            1.0.0-preview2-1-003177
 Commit SHA-1 hash:  a2df9c2576

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64

VS Code version: 1.8.1
C# Extension version: 1.6.0

Appears to be after project selection that it crashes.

Same, in win 7 environment.

C:\Users\xxxxxx>dotnet --info
.NET Command Line Tools (1.0.0-preview2-1-003177)

Product Information:
 Version:            1.0.0-preview2-1-003177
 Commit SHA-1 hash:  a2df9c2576

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64

VS Code version: 1.8.1
C# Extension version: 1.6.0

This happens every time I select a *.cs file

That sounds pretty terrible, and I haven't seen it before. One idea I have is that a previous version of the extension did not uninstall cleanly. Try this:

  1. Close Visual Studio Code.
  2. Delete all versions of the C# extension from disk.

    • Windows: Go to %UserProfile%\.vscode\extensions\ and delete any ms-vscode.csharp.* extensions.

    • OSX/Linux: Go to ~/.vscode/extensions/ and delete any ms-vscode.csharp.* extensions.

  3. Launch Visual Studio Code with your project and open a C# file.
  4. At this point, Visual Studio Code should recommend installing the latest C# extension.
  5. Go ahead and install the latest C# extension.

After re-installing, if the issue still occurs select "Help -> Toggle Developer Tools" and choose the "Console" tab. Let me know what you see in that tab.

Hi, I reinstalled the extensions, opened a C# file and the issue happened again. This is the last part of the console log.

[Extension Host] Object {exception: null, error: "cannot open file:///c%3A/Users/rafaelanez/Source/R鈥sers\rafaelanez\Source\Repos\RoadMap\bower.json)", promise: Object, id: 3}
shell.ts:541cannot open file:///c%3A/Users/rafaelanez/Source/Repos/RoadMap/bower.json. Detail: Archivo no encontrado (c:\Users\rafaelanez\Source\Repos\RoadMap\bower.json)e.onUnexpectedError @ shell.ts:541(anonymous function) @ shell.ts:457e.onUnexpectedError @ errors.ts:68o @ errors.ts:88t.onUnexpectedExtHostError @ mainThreadErrors.ts:13e.handle @ abstractThreadService.ts:34s @ ipcRemoteCom.ts:269f @ ipcRemoteCom.ts:226_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98
6extensionHost.ts:293 [Extension Host] _isHugeProject = false (0)
extensionHost.ts:293 [Extension Host] Uncaught Exception:  SyntaxError: Unexpected token / in JSON at position 6A.logExtensionHostMessage @ extensionHost.ts:293A.onMessaage @ extensionHost.ts:232(anonymous function) @ extensionHost.ts:171emitTwo @ events.js:106emit @ events.js:191process.nextTick @ internal/child_process.js:744_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98
extensionHost.ts:293 [Extension Host] SyntaxError: Unexpected token / in JSON at position 6
    at fs.readFile (C:\Users\rafaelanez\.vscode\extensions\ms-vscode.csharp-1.6.0\out\src\assets.js:254:44)
    at C:\Users\rafaelanez\.vscode\extensions\ms-vscode.csharp-1.6.0\node_modules\graceful-fs\graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)A.logExtensionHostMessage @ extensionHost.ts:293A.onMessaage @ extensionHost.ts:232(anonymous function) @ extensionHost.ts:171emitTwo @ events.js:106emit @ events.js:191process.nextTick @ internal/child_process.js:744_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98
messageService.ts:126 El host de extensiones finaliz贸 inesperadamente. Recargue la ventana para recuperarlo.e.doShow @ messageService.ts:126e.show @ messageService.ts:105A.onExit @ extensionHost.ts:328(anonymous function) @ extensionHost.ts:180emitTwo @ events.js:106emit @ events.js:191ChildProcess._handle.onexit @ internal/child_process.js:215
extensionHost.ts:332 Extension host terminated unexpectedly. Code:  7  Signal:  nullA.onExit @ extensionHost.ts:332(anonymous function) @ extensionHost.ts:180emitTwo @ events.js:106emit @ events.js:191ChildProcess._handle.onexit @ internal/child_process.js:215

That's very helpful -- thanks! It looks like it's failing in this code. Could you provide the text of your project's .vscode\tasks.json file? I'm wondering if the file is empty or the JSON is malformed.

Hi. This is the content in my tasks.json. It was added by vscode.

{
    // See http://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "dotnet",
    "isShellCommand": true,
    "args": [],
    "tasks": [
        {
            "taskName": "build",
            "args": [
                "server"
            ],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        },
        {
            "taskName": "publish",
            "args": [
                "-o",
                "build",
                "-f",
                "netcoreapp1.0",
                "server"
            ],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        }
    ]
}

I think I see the problem. Please delete the comments and try again.

Problem solved. It was the comments in tasks.json

Great! I'll code up a solution and release an update to the extension later today.

That was quick! Removing the comments fixed it for me too. 馃憤

Glad to hear it. Working on a fix... :smile:

OK. I've merged the fix for this in our release branch. We'll release 1.6.1 later today with this fix. Thanks to everyone for your help!

The 1.6.1 release is on the marketplace with this fixed. Thanks again!

Hi to all. I have same problem

Version 1.11.0-insider
Commit 207686d256dafb78b247357ad8b96a95218a22a5
Date 2017-03-17T08:14:15.805Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0
Windows 10 Enterprise Last build and update

this problem occurs when i install C# extension. when i remove this extension every think ok !

I found the problem. some settings corrupted in this direction :
C:Program Files (x86)Microsoft VS Code Insidersresourcesappextensions
Remove all folders and restart vs-code to fix it !!

Was this page helpful?
0 / 5 - 0 ratings