Language server fails to recognize new files added via relative path outside project root
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- csharp, typescript, vscode
- Lĩnh vực
- developer-experience, devtools
Hướng nghiên cứu
Tái hiện vấn đề với multi-root workspace và csproj glob trong báo cáo, sau đó kiểm tra đường dẫn tải workspace/project của C# language-server và nhật ký C# được cung cấp. Xác minh hành vi khi một tệp .cs bên ngoài mới được tạo và mở. Hoàn tất khi tệp được project theo dõi và các tính năng ngôn ngữ hoạt động mà không cần khởi động lại VS Code.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Create a multi-root workspace
{
"folders": [
{
"name": "ScriptsDev",
"path": "."
},
{
"name": "Scripts",
"path": "./../Scripts"
}
]
}
- Write a csproj that includes external files using globbing
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Compile Include=".\..\Scripts\**\*.cs" />
</ItemGroup>
</Project>
- 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+e7aa4b537Runtime 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% |
- Ngôn ngữ chính
- TypeScript
- Star
- 3.1k
- Fork
- 738
- Merge trung bình
- 21 giờ 21 phút
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/vscode-csharp
-
Infrastructure Test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
dotnet/vscode-csharp#9791 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C# crashĐang mởBug C#DK Needs More Info Reliability Remote Extensions Roslyn LSP
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
dotnet/vscode-csharp#9807 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Editor-Formatting Resolved-Configuration Issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
dotnet/vscode-csharp#9804 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug Debugger
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
dotnet/vscode-csharp#9802 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
untriaged
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
dotnet/vscode-csharp#9787 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dotnet/vscode-csharp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
callstackincubator/rozenite#518 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area/Workflow Priority/Blocker Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
wso2/product-integrator#2622 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
area:bash bug has repro platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
anthropics/claude-code#98644 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
allure-framework/allure-js#1603 ·
Maintainer thường phản hồi trong vòng 1 ngày