Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

documentHighlight - ArgumentOutOfRangeException: The requested line number 14 must be less than the number of lines 12

Aperta
#9,479 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
csharp, vscode
Ambito
devtools

Direzione di ricerca

Inizia con la richiesta textDocument/documentHighlight e lo stack trace di DocumentHighlightsHandler, quindi riproduci il problema usando il file Models/Pessoa.cs menzionato e i dettagli dell’ambiente forniti. Il lavoro è completato quando questa richiesta documentHighlight non fallisce più con un errore di riga fuori intervallo; il payload non nomina alcun test di regressione esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug C#DK Needs Investigation Roslyn LSP

Type: Bug

Issue Description

Steps to Reproduce

Expected Behavior

Actual Behavior

Extension version: 2.140.9
VS Code version: Code 1.126.0 (7e7950df89d055b5a378379db9ee14290772148a, 2026-06-23T01:46:13Z)
OS version: Windows_NT x64 10.0.26200
Modes:

Logs
C# log
2026-06-28 18:02:39.060 [info] Locating .NET runtime version 10.0.5
2026-06-28 18:02:39.866 [info] Dotnet path: c:\Users\admin\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\10.0.9~x64~aspnetcore\dotnet.exe
2026-06-28 18:02:39.866 [info] Activating C# + C# Dev Kit...
2026-06-28 18:02:40.051 [info] info: Program[0]
2026-06-28 18:02:40.051 [info]       Server started with process ID 18528
2026-06-28 18:02:40.764 [info] [Program] Language server initialized
2026-06-28 18:02:40.765 [info] [Program] Monitoring client process 8236 for exit
2026-06-28 18:02:41.303 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03' in 8 milliseconds
2026-06-28 18:02:42.174 [info] [textDocument/_vs_getProjectContexts] [Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager] .NET BuildHost started from c:\Users\admin\.vscode\extensions\ms-dotnettools.csharp-2.140.9-win32-x64\.roslyn\Microsoft.CodeAnalysis.LanguageServer.exe reloading to start from C:\Program Files\dotnet\dotnet.exe to match necessary SDK location.
2026-06-28 18:02:43.898 [warning] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] O projeto C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\89bc0947-2559-4938-b34b-e08084d00ef6\Canonical.csproj tem dependências não resolvidas
2026-06-28 18:02:44.032 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Carregamento de c:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03\Program.cs concluído com sucesso
2026-06-28 18:02:44.079 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Restaurando Canonical.csproj: Executando dotnet restore em C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\89bc0947-2559-4938-b34b-e08084d00ef6\Canonical.csproj
2026-06-28 18:02:44.083 [info] [textDocument/_vs_getProjectContexts] [Microsoft.CodeAnalysis.LanguageServer.DotnetCliHelper] Using dotnet executable configured on the PATH
2026-06-28 18:02:45.373 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03\Aula 03.csproj loaded by C# Dev Kit
2026-06-28 18:02:45.532 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Restaurando Canonical.csproj:   Determining projects to restore...
2026-06-28 18:02:45.949 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Restaurando Canonical.csproj:   Restored C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\89bc0947-2559-4938-b34b-e08084d00ef6\Canonical.csproj (in 77 ms).
2026-06-28 18:02:45.982 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Restauração concluída
2026-06-28 18:02:45.984 [info] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] (Re)carregamento concluído de todos os projetos em 00:00:04.1568310
2026-06-28 18:02:46.582 [info] [workspace/didChangeWatchedFiles] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:00.0015115
2026-06-28 18:23:49.911 [info] Locating .NET runtime version 10.0.5
2026-06-28 18:23:50.721 [info] Dotnet path: c:\Users\admin\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\10.0.9~x64~aspnetcore\dotnet.exe
2026-06-28 18:23:50.721 [info] Activating C# + C# Dev Kit...
2026-06-28 18:23:50.889 [info] info: Program[0]
2026-06-28 18:23:50.889 [info]       Server started with process ID 26680
2026-06-28 18:23:51.587 [info] [Program] Language server initialized
2026-06-28 18:23:51.587 [info] [Program] Monitoring client process 31796 for exit
2026-06-28 18:23:52.104 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03' in 8 milliseconds
2026-06-28 18:23:56.353 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03\Aula 03.csproj loaded by C# Dev Kit
2026-06-28 18:27:34.839 [info] [textDocument/diagnostic] [Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager] .NET BuildHost started from c:\Users\admin\.vscode\extensions\ms-dotnettools.csharp-2.140.9-win32-x64\.roslyn\Microsoft.CodeAnalysis.LanguageServer.exe reloading to start from C:\Program Files\dotnet\dotnet.exe to match necessary SDK location.
2026-06-28 18:27:35.984 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] (Re)carregamento concluído de todos os projetos em 00:00:01.5407977
2026-06-28 19:30:01.968 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Users/admin/OneDrive/Desktop/SENAI - BACK END/Aula 03/Models/Pessoa.cs
2026-06-28 19:30:01.969 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Users/admin/OneDrive/Desktop/SENAI - BACK END/Aula 03/Models/Pessoa.cs
2026-06-28 19:30:01.969 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Users/admin/OneDrive/Desktop/SENAI - BACK END/Aula 03/Models/Pessoa.cs
2026-06-28 19:30:43.815 [error] [textDocument/documentHighlight] [LSP] System.ArgumentOutOfRangeException: The requested line number 14 must be less than the number of lines 12. (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 219
   at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentHighlightsHandler.GetHighlightsAsync(IGlobalOptionService globalOptions, IHighlightingService highlightingService, Document document, LinePosition linePosition, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs:line 56
   at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentHighlightsHandler.HandleRequestAsync(TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs:line 50
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
2026-06-28 19:30:43.829 [error] Request textDocument/documentHighlight failed.
  Message: The requested line number 14 must be less than the number of lines 12. (Parameter 'Line')
  Code: -32000 
[object Object]
2026-06-28 19:30:43.888 [warning] [textDocument/diagnostic] [LanguageServerProjectLoader] O projeto C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\9b4b6500-ae6b-4033-a873-19ff06164cb0\Canonical.csproj tem dependências não resolvidas
2026-06-28 19:30:43.938 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Carregamento de c:\Users\admin\OneDrive\Desktop\SENAI - BACK END\Aula 03\Models\Pessoa.cs concluído com sucesso
2026-06-28 19:30:43.947 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restaurando Canonical.csproj: Executando dotnet restore em C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\9b4b6500-ae6b-4033-a873-19ff06164cb0\Canonical.csproj
2026-06-28 19:30:43.947 [info] [textDocument/diagnostic] [Microsoft.CodeAnalysis.LanguageServer.DotnetCliHelper] Using dotnet executable configured on the PATH
2026-06-28 19:30:44.539 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restaurando Canonical.csproj:   Determining projects to restore...
2026-06-28 19:30:44.768 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restaurando Canonical.csproj:   Restored C:\Users\admin\AppData\Local\Temp\roslyn-canonical-misc\9b4b6500-ae6b-4033-a873-19ff06164cb0\Canonical.csproj (in 54 ms).
2026-06-28 19:30:44.803 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restauração concluída
2026-06-28 19:30:44.804 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] (Re)carregamento concluído de todos os projetos em 00:00:00.9444103
2026-06-28 19:30:45.314 [info] [workspace/didChangeWatchedFiles] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:00.0001642

C# LSP Trace Logs log

Environment Information

VSCode version: 1.126.0
C# Extension: 2.140.9
Using OmniSharp: false

Dotnet Information

Host:
Version: 10.0.9
Architecture: x64
Commit: 901ca94124
RID: win-x64

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.9 [c:\Users\admin\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\10.0.9x64aspnetcore\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.9 [c:\Users\admin\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\10.0.9x64aspnetcore\shared\Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_CLI_UI_LANGUAGE [en-US]
DOTNET_NOLOGO [true]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

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

Visual Studio Code Extensions
Extension Author Version Folder Name
csdevkit ms-dotnettools 3.20.199 ms-dotnettools.csdevkit-3.20.199-win32-x64
csharp ms-dotnettools 2.140.9 ms-dotnettools.csharp-2.140.9-win32-x64
csharpextensions kreativ-software 1.7.3 kreativ-software.csharpextensions-1.7.3
vscode-dotnet-runtime ms-dotnettools 3.1.0 ms-dotnettools.vscode-dotnet-runtime-3.1.0
vscode-icons vscode-icons-team 12.19.0 vscode-icons-team.vscode-icons-12.19.0
C# Settings
Setting Value
preferCSharpExtension false
compilerDiagnosticScope openFiles
analyzerDiagnosticScope openFiles
enableXamlTools true
useServerGC true
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1265U (12 x 2688)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x46a8 [Intel(R) Iris(R) Xe Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.7084 ACTIVE
GPU1: VENDOR= 0x8086, DEVICE=0x46a8 [Intel(R) Iris(R) Xe Graphics], DRIVER_VERSION=32.0.101.7084
GPU2: VENDOR= 0x8086, DEVICE=0x46a8 [Intel(R) Iris(R) Xe Graphics], DRIVER_VERSION=32.0.101.7084
GPU3: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8521
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 47.69GB (30.91GB free)
Process Argv --crash-reporter-id 8a577974-0021-463d-98ec-89ba833c71a7
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsdeactivate2:31538737
478i5457:31521843
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
c3h7c220:31478652
38bie571_auto:31426784
cp_cls_c_1081:31454833
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
c9b86496:31447327
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
7e187181:31503455
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
23c7c724:31520045
ddid_c:31478207
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
db5d2638:31499441
nes-extended-cfe-himalia-004:31500446
jb_cp_cls_t_632:31537244
748c7209:31512887
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
31fi7170_t:31522396
jh5f2457_c:31540921
41836166:31537719
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31533504
jf4hg949:31526829
nes-curr-leftover-1500:31538366
h561g132:31533256
session_8:31532895
ihg5j128:31534457

Lingua principale
TypeScript
Stelle
3.1k
Fork
741
Merge medio
1g 3h
PR unite (30g)
52

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/vscode-csharp

Tutte le issue di dotnet/vscode-csharp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.