Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Razor server fails to launch with only .net9 installed #10132

Closed
dibarbet opened this issue Mar 19, 2024 · 10 comments
Closed

Razor server fails to launch with only .net9 installed #10132

dibarbet opened this issue Mar 19, 2024 · 10 comments

Comments

@dibarbet
Copy link
Member

Copied from comment here - dotnet/vscode-csharp#6980 (comment)

Looks like the Razor server does not roll forward (currently the dotnet runtime installer allows any dotnet greater than 8).

This issue also reproduces on the .NET9.0 SDK with VSCode v 1.87.2, C# Dev Kit v 1.4.29, C# v 2.22.5.
The 'Razor Logs' output window logs show as below:
image
image (1)

Using dotnet configured on PATH
[Client - 3:15:55 PM] Razor language server path: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
[Client - 3:15:55 PM] Server arguments --logLevel 2 --projectConfigurationFileName project.razor.vscode.bin --DelegateToCSharpOnDiagnosticPublish true --UpdateBuffersForClosedDocuments true --telemetryLevel all --sessionId 3cf33dfc-3ae6-4b08-a51f-a57b103873fb1710832553170 --telemetryExtensionPath /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razortelemetry/Microsoft.VisualStudio.DevKit.Razor.dll
[Client - 3:15:55 PM] Starting Razor Language Server...
You must install or update .NET to run this application.
 
App: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/local/share/dotnet
 
The following frameworks were found:
  9.0.0-preview.3.24162.31 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
 
Learn more:
https://aka.ms/dotnet/app-launch-failed
 
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=osx-x64&os=osx.12
[Error - 3:15:55 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Info  - 3:15:55 PM] Connection to server got closed. Server will restart.
true
[Error - 3:15:55 PM] Razor Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097
You must install or update .NET to run this application.
 
App: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/local/share/dotnet
 
The following frameworks were found:
  9.0.0-preview.3.24162.31 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
 
Learn more:
https://aka.ms/dotnet/app-launch-failed
 
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=osx-x64&os=osx.12
[Error - 3:15:55 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Info  - 3:15:55 PM] Connection to server got closed. Server will restart.
true
[Error - 3:15:55 PM] Razor Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Client - 3:15:55 PM] (Error) Failed when activating Razor VSCode.
Pending response rejected since connection got disposed
Stack Trace:
Error: Pending response rejected since connection got disposed
  at Object.dispose (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2098108)
  at Object.dispose (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2152884)
  at S.handleConnectionClosed (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2153290)
  at S.handleConnectionClosed (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2311358)
  at /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2153033
  at i.invoke (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2099821)
  at o.fire (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2100586)
  at te (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2086231)
  at i.invoke (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2099821)
  at o.fire (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2100586)
  at v.fireClose (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2108439)
  at Socket.<anonymous> (/Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/dist/extension.js:2:2110033)
  at Socket.emit (node:events:526:35)
  at Pipe.<anonymous> (node:net:323:12)
You must install or update .NET to run this application.
 
App: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/local/share/dotnet
 
The following frameworks were found:
  9.0.0-preview.3.24162.31 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
 
Learn more:
https://aka.ms/dotnet/app-launch-failed
 
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=osx-x64&os=osx.12
[Error - 3:15:55 PM] Server initialization failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099
[Error - 3:15:55 PM] Razor Language Server client: couldn't create connection to server.
  Message: Cannot call write after a stream was destroyed
  Code: -32099
[Error - 3:15:55 PM] Restarting server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099
[Error - 3:15:55 PM] Restarting server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099
[Info  - 3:15:55 PM] Connection to server got closed. Server will restart.
true
You must install or update .NET to run this application.
 
App: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/local/share/dotnet
 
The following frameworks were found:
  9.0.0-preview.3.24162.31 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
 
Learn more:
https://aka.ms/dotnet/app-launch-failed
 
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=osx-x64&os=osx.12
[Error - 3:15:55 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Info  - 3:15:55 PM] Connection to server got closed. Server will restart.
true
[Error - 3:15:55 PM] Razor Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097
You must install or update .NET to run this application.
 
App: /Users/vs/.vscode/extensions/ms-dotnettools.csharp-2.22.5-darwin-x64/.razor/rzls
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/local/share/dotnet
 
The following frameworks were found:
  9.0.0-preview.3.24162.31 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
 
Learn more:
https://aka.ms/dotnet/app-launch-failed
 
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=osx-x64&os=osx.12
[Error - 3:15:55 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Error - 3:15:55 PM] The Razor Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 3:15:55 PM] Razor Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Error - 3:15:55 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/Privacy.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Privacy.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Privacy.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/Error.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Error.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Error.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/Shared/_ValidationScriptsPartial.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Shared/_ValidationScriptsPartial.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Shared/_ValidationScriptsPartial.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/_ViewStart.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/_ViewStart.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/_ViewStart.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/_ViewImports.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/_ViewImports.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/_ViewImports.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/Index.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Index.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Index.cshtml__virtual.cs
[Client - 3:16:04 PM] File '/Users/vs/RazorNoAuth/Pages/Shared/_Layout.cshtml' didn't exist in the Razor document list. This is likely because it's from outside the workspace.
[Client - 3:16:04 PM] (Warning) razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Shared/_Layout.cshtml__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Users/vs/RazorNoAuth/Pages/Shared/_Layout.cshtml__virtual.cs
@davidwengier
Copy link
Contributor

@ryzngard is this fixed by #10064 ?

@ryzngard
Copy link
Contributor

Yes, it should be

@v-Judy
Copy link

v-Judy commented Mar 28, 2024

@dibarbet This issue still reproduces on the latest .NET 9.0 Preview 3 SDK (install from the https://github.com/dotnet/installer) 9.0.100-preview.3.24175.24 . No update version for C# Dev Kit, C# and VSCode. Could you help me to take a look?

@dibarbet
Copy link
Member Author

@dibarbet This issue still reproduces on the latest .NET 9.0 Preview 3 SDK (install from the https://github.com/dotnet/installer) 9.0.100-preview.3.24175.24 . No update version for C# Dev Kit, C# and VSCode. Could you help me to take a look?

@ryzngard was this merged into VSCode last week? If it was it should be fixed in the prerelease we did this week.

@dibarbet
Copy link
Member Author

Nevermind, I see it is in 2.23.14 - https://github.com/dotnet/vscode-csharp/releases/tag/v2.23.14
@v-Judy try the latest prerelease of the C# extension (2.23.14)

@v-Judy
Copy link

v-Judy commented Apr 8, 2024

@v-Judy try the latest prerelease of the C# extension (2.23.14)

@dibarbet Thanks for your reply! I'm sorry so late to give the results. This issue does not repro on the latest version v2.23.15 for C# Extension.

@ryzngard
Copy link
Contributor

ryzngard commented Apr 8, 2024

@v-Judy do you mind checking the runtimesettings file on your machine? Locally for me it was located at ~\.vscode\extensions\ms-dotnettools.csharp-2.24.17-win32-x64\.razor\rzls.runtimeconfig.json (this is the latest prerelease I had installed) and the contents were as follows

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "rollForward": "LatestMajor",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.0"
    },
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

The key is that the "version": "8.0.0" is present. If you have "version": "8.0.1" or any other value for "rollForward": "LatestMajor" then you still have an extension without the fix

@davidwengier
Copy link
Contributor

They said it does not repro on the latest version, so I think we're all good :)

@ryzngard
Copy link
Contributor

ryzngard commented Apr 8, 2024

They said it does not repro on the latest version, so I think we're all good :)

omg... ☕ needed. It's been a long day already 🤣

Everything has been falling apart so I just assumed this too. Yay for a win!

@v-Judy
Copy link

v-Judy commented Apr 9, 2024

@v-Judy do you mind checking the runtimesettings file on your machine?

The runtimesettings file on my machine contents were as follows:

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "rollForward": "LatestMajor",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.1"
    },
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants