I am working on this personal Blazor project (https://github.com/nexus-main/nexus) and I get many false-positive errors/warnings in general working with Blazor + Visual Studio Code. This is very annoying and I hope this extension (C# Dev Kit or whatever powering Blazor/Razor) will improve on that front. You are surely aware of the disappointment in the the Visual Studio Marketplace and something needs to happen, otherwise developers will orient towards other solutions (languages or toolkits) which would be very sad for Blazor as it is a great technology.
So yes, I am also very annoyed but I want to help resolve these randomly occuring problems by reporting a specific error I just encountered right after opening the above mentioned project:
[Error - 10:11:40] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 355 must be less than the number of lines 348. (Parameter 'Line')
at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
at Microsoft.CodeAnalysis.LanguageServer.Extensions.GetPositionFromLinePositionAsync(TextDocument document, LinePosition linePosition, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Extensions/Extensions.cs:line 163
at Microsoft.CodeAnalysis.LanguageServer.Handler.HoverHandler.HandleRequestAsync(TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs:line 47
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
[Error - 10:11:40] Request textDocument/hover failed.
Message: The requested line number 355 must be less than the number of lines 348. (Parameter 'Line')
Code: -32000
[object Object]
Steps To Reproduce
I am not sure you will be able to reproduce the exact error as everything with Razor language support is very flaky. But if you try to work with the project you will encounter some other misbehaviour after short time, for sure.
But maybe I have just discovered a way to reproduce:
Try to hover over ProjectUrl in line 52 or any other property
I think uncommenting the code causes the error. Before doing so, it works fine (except that now during testing on my side everything is red underlined :-():
I hope you see that this is quite annoying and hard to use at all.
Expected Behavior
Hover should work, no red underlining, no tons of RZ10012 warnings
Describe the Issue
I am working on this personal Blazor project (https://github.com/nexus-main/nexus) and I get many false-positive errors/warnings in general working with Blazor + Visual Studio Code. This is very annoying and I hope this extension (C# Dev Kit or whatever powering Blazor/Razor) will improve on that front. You are surely aware of the disappointment in the the Visual Studio Marketplace and something needs to happen, otherwise developers will orient towards other solutions (languages or toolkits) which would be very sad for Blazor as it is a great technology.
So yes, I am also very annoyed but I want to help resolve these randomly occuring problems by reporting a specific error I just encountered right after opening the above mentioned project:
Steps To Reproduce
I am not sure you will be able to reproduce the exact error as everything with Razor language support is very flaky. But if you try to work with the project you will encounter some other misbehaviour after short time, for sure.
But maybe I have just discovered a way to reproduce:
vscode-dotnettools
ProjectUrl
in line 52 or any other propertyI think uncommenting the code causes the error. Before doing so, it works fine (except that now during testing on my side everything is red underlined :-():
I hope you see that this is quite annoying and hard to use at all.
Expected Behavior
Hover should work, no red underlining, no tons of RZ10012 warnings
Environment Information