Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Language server fails to recognize new files added via relative path outside project root

Abierto
#9,360 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp, typescript, vscode

Línea de trabajo

Reproduce el problema con el espacio de trabajo multi-root y el glob de csproj del informe. Después, inspecciona la ruta de carga del workspace/proyecto del C# language-server y el registro de C# proporcionado. Verifica el comportamiento cuando se crea y se abre un nuevo archivo .cs externo. Se considera terminado cuando el proyecto realiza el seguimiento del archivo y las funciones del lenguaje funcionan sin reiniciar VS Code.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

C#DK untriaged

Type: Bug

Issue Description

I have a workspace configured where a csproj file is stored in a different root than the actual source files. I then use a .code-workspace and <Compile Include=".\..\Scripts\**\*.cs" /> to make the source files visible to the language server. When I create a new source file, VSCode doesn't recognize it properly and I get the error "The active document is not part of the open workspace. Not all language features will be available." Interestingly enough, I have a similar problem when I open my solution in Visual Studio and create a new file. Restarting the entire IDE solves the issue but only until the next file is created.

Steps to Reproduce

I have my setup on Github.

  1. Create a multi-root workspace
{
    "folders": [
        {
            "name": "ScriptsDev",
            "path": "."
        },
        {
            "name": "Scripts",
            "path": "./../Scripts"
        }
    ]
}
  1. Write a csproj that includes external files using globbing
<Project Sdk="Microsoft.NET.Sdk">
    <ItemGroup>
        <Compile Include=".\..\Scripts\**\*.cs" />
    </ItemGroup>
</Project>
  1. Now try adding a new .cs file in Scripts. It will show up in VSCode but when you try editing it, the C# extension will show the aforementioned error message.

Expected Behavior

The language server should recognize the newly created file and import it into the project. I should then be able to use all language features without needing to restart VSCode.

Actual Behavior

When I open the new file, I cannot access my dependencies or my own types. Then, the C# extension shows a pop up with this error: The active document is not part of the open workspace. Not all language features will be available.

Logs

Extension version: 2.140.8
VS Code version: Code 1.121.0 (f6cfa2ea2403534de03f069bdf160d06451ed282, 2026-05-19T11:51:53+02:00)
OS version: Windows_NT x64 10.0.26100
Modes:

C# log
2026-05-29 20:32:34.070 [info] Locating .NET runtime version 10.0.5
2026-05-29 20:32:34.196 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2026-05-29 20:32:34.196 [info] Activating C# + C# Dev Kit...
2026-05-29 20:32:34.336 [info] info: Program[0]
2026-05-29 20:32:34.336 [info]       Server started with process ID 3712
2026-05-29 20:32:34.999 [info] [Program] Language server initialized
2026-05-29 20:32:35.000 [info] [Program] Monitoring client process 4984 for exit
2026-05-29 20:32:35.859 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\ScriptsDev' in 6 milliseconds
2026-05-29 20:32:38.071 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Program Files\Epic Games\BatmanArkhamCity\BmGame\ScriptsDev\ScriptsDev.csproj loaded by C# Dev Kit
2026-05-29 20:43:37.551 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Program Files/Epic Games/BatmanArkhamCity/BmGame/Mods/CharacterSwappingScript/scripts/Patches/test.cs
2026-05-29 20:43:37.551 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Program Files/Epic Games/BatmanArkhamCity/BmGame/Mods/CharacterSwappingScript/scripts/Patches/test.cs
2026-05-29 20:43:37.551 [warning] [textDocument/diagnostic] [LSP] Ignoring diagnostics request for untracked document: file:///c:/Program Files/Epic Games/BatmanArkhamCity/BmGame/Mods/CharacterSwappingScript/scripts/Patches/test.cs
2026-05-29 20:44:21.297 [info] Locating .NET runtime version 10.0.5
2026-05-29 20:44:21.499 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2026-05-29 20:44:21.499 [info] Activating C# + C# Dev Kit...
2026-05-29 20:44:21.668 [info] info: Program[0]
2026-05-29 20:44:21.668 [info]       Server started with process ID 15312
2026-05-29 20:44:22.227 [info] [Program] Language server initialized
2026-05-29 20:44:22.239 [info] [Program] Monitoring client process 12200 for exit
2026-05-29 20:44:22.641 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\ScriptsDev' in 6 milliseconds
2026-05-29 20:44:22.666 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\Scripts' in 2 milliseconds
2026-05-29 20:44:22.675 [info] [initialized] [Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsEntryPointDiscovery] Finished discovery in 'c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\Mods' in 8 milliseconds
2026-05-29 20:44:24.798 [info] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project C:\Program Files\Epic Games\BatmanArkhamCity\BmGame\ScriptsDev\ScriptsDev.csproj loaded by C# Dev Kit
2026-05-29 20:44:32.306 [info] [textDocument/diagnostic] [Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager] .NET BuildHost started from c:\Users\Jonkler\.vscode\extensions\ms-dotnettools.csharp-2.140.8-win32-x64\.roslyn\Microsoft.CodeAnalysis.LanguageServer.exe reloading to start from C:\Program Files\dotnet\dotnet.exe to match necessary SDK location.
2026-05-29 20:44:33.160 [warning] [textDocument/diagnostic] [LanguageServerProjectLoader] Project C:\Users\Jonkler\AppData\Local\Temp\roslyn-canonical-misc\c8f30402-aff3-4a4f-b03b-723166e14ed6\Canonical.csproj has unresolved dependencies
2026-05-29 20:44:33.189 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Successfully completed load of c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\Scripts\Test.cs
2026-05-29 20:44:33.206 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restoring Canonical.csproj: Running dotnet restore on C:\Users\Jonkler\AppData\Local\Temp\roslyn-canonical-misc\c8f30402-aff3-4a4f-b03b-723166e14ed6\Canonical.csproj
2026-05-29 20:44:33.206 [info] [textDocument/diagnostic] [Microsoft.CodeAnalysis.LanguageServer.DotnetCliHelper] Using dotnet executable configured on the PATH
2026-05-29 20:44:33.745 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restoring Canonical.csproj:   Determining projects to restore...
2026-05-29 20:44:34.029 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restoring Canonical.csproj:   Restored C:\Users\Jonkler\AppData\Local\Temp\roslyn-canonical-misc\c8f30402-aff3-4a4f-b03b-723166e14ed6\Canonical.csproj (in 69 ms).
2026-05-29 20:44:34.054 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Restore complete
2026-05-29 20:44:34.054 [info] [textDocument/diagnostic] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:01.9633818
2026-05-29 20:44:34.551 [info] [workspace/didChangeWatchedFiles] [LanguageServerProjectLoader] Successfully completed load of c:\Program Files\Epic Games\BatmanArkhamCity\BmGame\Scripts\Test.cs
2026-05-29 20:44:34.551 [info] [workspace/didChangeWatchedFiles] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:00.0060601

C# LSP Trace Logs log

Environment Information

VSCode version: 1.121.0
C# Extension: 2.140.8
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 10.0.204 Commit: e7aa4b537d Workload version: 10.0.200-manifests.e0989437 MSBuild version: 18.3.3+e7aa4b537

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.204\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.8
Architecture: x64
Commit: 94ea82652c

.NET SDKs installed:
10.0.204 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [true]
DOTNET_CLI_UI_LANGUAGE [en-US]
DOTNET_MULTILEVEL_LOOKUP [0]

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
catppuccin-vsc Catppuccin 3.19.0 catppuccin.catppuccin-vsc-3.19.0
catppuccin-vsc-icons Catppuccin 1.26.0 catppuccin.catppuccin-vsc-icons-1.26.0
catppuccin-vsc-pack catppuccin 1.0.2 catppuccin.catppuccin-vsc-pack-1.0.2
clang-format xaver 1.9.0 xaver.clang-format-1.9.0
cmake-tools ms-vscode 1.23.52 ms-vscode.cmake-tools-1.23.52
cpp-devtools ms-vscode 0.5.13 ms-vscode.cpp-devtools-0.5.13
cpptools ms-vscode 1.32.2 ms-vscode.cpptools-1.32.2-win32-x64
cpptools-extension-pack ms-vscode 1.5.1 ms-vscode.cpptools-extension-pack-1.5.1
cpptools-themes ms-vscode 2.0.0 ms-vscode.cpptools-themes-2.0.0
csdevkit ms-dotnettools 3.20.199 ms-dotnettools.csdevkit-3.20.199-win32-x64
csharp ms-dotnettools 2.140.8 ms-dotnettools.csharp-2.140.8-win32-x64
csharpier-vscode csharpier 10.0.3 csharpier.csharpier-vscode-10.0.3
even-better-toml tamasfe 0.21.2 tamasfe.even-better-toml-0.21.2
intellij-idea-keybindings k--kato 1.7.7 k--kato.intellij-idea-keybindings-1.7.7
powershell ms-vscode 2025.4.0 ms-vscode.powershell-2025.4.0
uc EliotVU 0.8.4 eliotvu.uc-0.8.4
vscode-dotnet-runtime ms-dotnettools 3.0.2 ms-dotnettools.vscode-dotnet-runtime-3.0.2
C# Settings
Setting Value
preferCSharpExtension false
compilerDiagnosticScope openFiles
analyzerDiagnosticScope openFiles
enableXamlTools true
useServerGC true
System Info
Item Value
CPUs AMD Ryzen 7 3700X 8-Core Processor (16 x 3600)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x10de, DEVICE=0x2504 [NVIDIA GeForce RTX 3060], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=32.0.15.9186 ACTIVE
GPU1: VENDOR= 0x10de, DEVICE=0x2504 [NVIDIA GeForce RTX 3060], DRIVER_VERSION=32.0.15.9186
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8328
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
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.93GB (9.40GB free)
Process Argv
Screen Reader no
VM 0%
Lenguaje dominante
TypeScript
Estrellas
3.1k
Forks
738
Merge medio
21 h 21 min
PR fusionados (30 d)
42

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/vscode-csharp

Todos los issues de dotnet/vscode-csharp

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.