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

VSCode .Net Core MVC reports problems but Project Builds and Runs just fine #4134

Closed
mikemurphysmind opened this issue Oct 21, 2020 · 4 comments

Comments

@mikemurphysmind
Copy link

Please paste the output from your clipboard## Issue Description ##

Steps to Reproduce

Expected Behavior

Actual Behavior

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.50.1
C# Extension: 1.23.4

Mono Information OmniSharp using global mono :6.4.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.402 Commit: 9b5de826fd

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.402/

Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd

.NET Core SDKs installed:
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.402 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
azure-account ms-vscode 0.9.3
azure-iot-toolkit vsciot-vscode 2.16.4
azure-pipelines ms-azure-devops 1.177.0
azure-storage-explorer formulahendry 0.1.2
azurecli ms-vscode 0.5.0
azurerm-vscode-tools msazurermtools 0.13.0
csharp ms-dotnettools 1.23.4
mssql ms-mssql 1.9.0
prettier-vscode esbenp 5.7.1
python ms-python 2020.9.114305
rest-client humao 0.24.3
vscode-ai ms-toolsai 0.6.16
vscode-apimanagement ms-azuretools 0.1.6
vscode-azureappservice ms-azuretools 0.19.0
vscode-azurefunctions ms-azuretools 1.0.0
vscode-azureresourcegroups ms-azuretools 0.2.0
vscode-azurestorage ms-azuretools 0.10.1
vscode-azurevirtualmachines ms-azuretools 0.2.0
vscode-cosmosdb ms-azuretools 0.15.0
vscode-css-peek pranaygp 4.0.0
vscode-docker ms-azuretools 1.7.0
vscode-dotnet-runtime ms-dotnettools 0.1.2
vscode-node-azure-pack ms-vscode 0.0.11
vscode-nuget-package-manager jmrog 1.1.6
xml DotJoshJohnson 2.5.1

These errors just started yesteday. Before this everything was fine.

To troubleshoot the issue, I created a new .Net Core MVC project using dotnet new mvc. I opened the project in vscode with no modifications. VSCode n OSX immediately showed the errors/problems. I opened this new project in VSCode on Windows. No errors.
On VSCode OSX I removed the C# extension and the errors disappeared. I reinstalled the C# extension and the errors returned.

Images showing issue
image
image

This only occurs in VSCode on OSX. VSCode on Windows does not exhibit this issue.

@Cooksauce
Copy link

I'm running into this same issue as well (also on macOS 10.15.7). Omnisharp Logs...

Razor Fail:

[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/path/to/Redacted.Project.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /path/to/Redacted.Project.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        rzc generate exited with code 129.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/path/to/Redacted.Project.csproj'.
/path/to/Redacted.Project.csproj
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets(106,5): Error: rzc generate exited with code 129.

Host Exception

[fail]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 6614,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\\nParameter name: character\\n  at Microsoft.CodeAnalysis.Text.LinePosition..ctor (System.Int32 line, System.Int32 character) [0x00013] in <74e762f007514b0991a005183ec8dcb2>:0 \\n  at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle (OmniSharp.Models.SemanticHighlight.SemanticHighlightRequest request) [0x00146] in <845c3087cc7d4530b36a8584d73f1c1d>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <0ff274924a1842faabf855aebc686508>:0 \"",
  "Body": null,
  "Seq": 7478,
  "Type": "response"
}
[fail]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 6617,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\\nParameter name: character\\n  at Microsoft.CodeAnalysis.Text.LinePosition..ctor (System.Int32 line, System.Int32 character) [0x00013] in <74e762f007514b0991a005183ec8dcb2>:0 \\n  at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle (OmniSharp.Models.SemanticHighlight.SemanticHighlightRequest request) [0x00146] in <845c3087cc7d4530b36a8584d73f1c1d>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <0b3dc7d6f0c8428682a86ac3f9663775>:0 \\n  at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <0ff274924a1842faabf855aebc686508>:0 \"",
  "Body": null,
  "Seq": 7484,
  "Type": "response"
}

@breiter
Copy link

breiter commented Oct 22, 2020

I think the problem is that the global mono is not compatible with the omnisharp that is embedded in the C# extension version 1.23.4.

Even if you have the latest stable 6.12.0.90 mono from https://www.mono-project.com/download/stable/, it doesn't work with this version of omnisharp. The good news is that the extension has its own embedded mono runtime and dependencies.

Uninstalling the global mono or setting the UseGlobalMono option for vscode in settings.json to "never" resolves the problem.

{    
  "omnisharp.useGlobalMono": "never"
}

I did some spelunking and while the mono binary that is embedded in the extension is 6.12.0.90, the msbuild engine is actually a preview that is 2 point releases newer than what is in the stable mono distribution. There may be other differences.

See also #4123 (comment)

@filipw
Copy link
Contributor

filipw commented Oct 22, 2020

Please set

{    
  "omnisharp.useGlobalMono": "never"
}

From the next version of the extension this will be the default option again (#4130)

With regards to Mono that is compatible with 3.1.402 SDK and .NET 5.0, see (and upvote) this issue mono/mono#20250 (comment). Without it there is not much else we can do to make global Mono work - in fact we manually build our own embedded Mono runtime that allows us to work around that.

@filipw filipw closed this as completed Oct 22, 2020
@filipw
Copy link
Contributor

filipw commented Oct 22, 2020

@Cooksauce the Razor exception is something else, could you please open a new issue for this Error: rzc generate exited with code 129. problem? thanks!

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