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

Creating class produces errors #5260

Closed
Igorgro opened this issue Jun 8, 2022 · 5 comments
Closed

Creating class produces errors #5260

Igorgro opened this issue Jun 8, 2022 · 5 comments

Comments

@Igorgro
Copy link

Igorgro commented Jun 8, 2022

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   6.0.201
 Commit:    ef40e6aa06

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.201/

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  6.0.201 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

VS Code version: 1.67.2
C# Extension version: 1.25.0

OmniSharp log

Log is full of the following messages:

[fail]: OmniSharp.Stdio.Host
        ************  Response (5.1360ms) ************ 
{
  "Request_seq": 5935,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.InvalidOperationException: Sequence contains more than one element\\n   at System.Linq.ThrowHelper.ThrowMoreThanOneElementException()\\n   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found)\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.CreateSemanticSpan(IEnumerable`1 results, TextLineCollection lines) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 82\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.<>c.<Handle>b__3_2(IGrouping`2 grouping) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 75\\n   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle(SemanticHighlightRequest request) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 78\\n   at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 218\\n   at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 234\\n   at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 143\\n   at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /Users/runner/work/1/s/src/OmniSharp.Stdio/Host.cs:line 258\"",
  "Body": null,
  "Seq": 11950,
  "Type": "response"
}

Steps to reproduce

  1. Create empty project
  2. Create new class in namespace

Expected behavior

No errors are shown

Actual behavior

Every new class is marked as already existing (error CS0101) and the log is flooded with the error message. The same thing happens when renaming existing classes. The only solution is to restart omnisharp after avery class creation which is very annoying.

Additional context

I've already posted similar issues here #5216 and here OmniSharp/omnisharp-roslyn#2391

@Winter
Copy link

Winter commented Aug 22, 2022

Reporting same exact problem and as @Igorgro. Have been experiencing it for a while but it's just getting beyond a joke having to restart Omnisharp after creating a new file.

@tmeadon
Copy link

tmeadon commented Sep 13, 2022

Same problem here.

Environment

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.400/

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  6.0.400 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

OmniSharp log

{
  "Type": "request",
  "Seq": 603,
  "Command": "/v2/highlight",
  "Arguments": {
    "FileName": "/home/tom/test/test/test.cs",
    "Line": 0,
    "Column": 0,
    "Range": null
  }
}
[fail]: OmniSharp.Stdio.Host
        ************  Response (1.7154ms) ************ 
{
  "Request_seq": 603,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.InvalidOperationException: Sequence contains more than one element\\n   at System.Linq.ThrowHelper.ThrowMoreThanOneElementException()\\n   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found)\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.CreateSemanticSpan(IEnumerable`1 results, TextLineCollection lines) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 82\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.<>c.<Handle>b__3_2(IGrouping`2 grouping) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 75\\n   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle(SemanticHighlightRequest request) in /Users/runner/work/1/s/src/OmniSharp.Roslyn.CSharp/Services/SemanticHighlight/SemanticHighlightService.cs:line 78\\n   at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 218\\n   at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 234\\n   at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in /Users/runner/work/1/s/src/OmniSharp.Host/Endpoint/EndpointHandler.cs:line 143\\n   at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in /Users/runner/work/1/s/src/OmniSharp.Stdio/Host.cs:line 258\"",
  "Body": null,
  "Seq": 4222,
  "Type": "response"
}

@ChopperRob
Copy link

Same problem, running on fully patched Ubuntu 22.04.

vscode version 1.71.2
C# Extension version 1.25.0

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   6.0.109
 Commit:    58a93139d8

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/lib/dotnet/dotnet6-6.0.109/sdk/6.0.109/

global.json file:
  Not found

Host:
  Version:      6.0.9
  Architecture: x64
  Commit:       163a63591c

.NET SDKs installed:
  6.0.109 [/usr/lib/dotnet/dotnet6-6.0.109/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

@jsiuaganatmyalii
Copy link

Have been experiencing this until now any fixes?

@JoeRobich
Copy link
Member

There have been lots of improvements since this issue was opened. Please open a new issue with logs if you are still running into this.

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

No branches or pull requests

7 participants