Skip to content

Errors in __virtual.cs files in Problems tab #8372

@BenjaminBrienen

Description

@BenjaminBrienen

Environment data

dotnet --info output:

PS C:\sources\COES> dotnet --info                                                                                                                       
.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.71a57da0
 MSBuild version:   17.12.18+ed8c6aec5

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

.NET workloads installed:
 [maui-windows]
   Installation Source: VS 17.12.35707.178
   Manifest Version:    9.0.14/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.14\WorkloadManifest.json
   Install Type:              Msi

 [aspire]
   Installation Source: VS 17.12.35707.178
   Manifest Version:    8.2.2/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
   Install Type:              Msi

 [wasm-tools]
   Installation Source: VS 17.12.35707.178
   Manifest Version:    9.0.6/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.6\WorkloadManifest.json
   Install Type:              Msi

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.6
  Architecture: x64
  Commit:       3875b54e7b

.NET SDKs installed:
  6.0.302 [C:\Program Files\dotnet\sdk]
  6.0.428 [C:\Program Files\dotnet\sdk]
  8.0.314 [C:\Program Files\dotnet\sdk]
  8.0.411 [C:\Program Files\dotnet\sdk]
  9.0.102 [C:\Program Files\dotnet\sdk]
  9.0.205 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.6 [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:
  Not set

VS Code version:

PS C:\sources\COES> code --version
1.101.0
dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1
x64

C# Extension version:

Name: C# Dev Kit
Id: ms-dotnettools.csdevkit
Description: Official C# extension from Microsoft
Version: 1.20.35
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit

C# logs

C# output window contents:

2025-06-18 10:59:49.886 [info] Starting Spawn .NET server...
2025-06-18 10:59:49.886 [info] Using dotnet resolution provided by ".NET Install Tool".
2025-06-18 10:59:49.889 [info] Starting opening a solution...
2025-06-18 10:59:49.889 [info] Starting processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server...
2025-06-18 10:59:52.568 [info] Using existing .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
2025-06-18 10:59:52.740 [info] .NET Sdk found: "C:\Program Files\dotnet\dotnet.exe".
2025-06-18 11:00:02.436 [info] .NET server started and IPC established in 9648ms
2025-06-18 11:00:02.449 [info] Completed Spawn .NET server (12571ms)
2025-06-18 11:00:13.437 [info] Completed processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server (23558ms)
2025-06-18 11:00:13.457 [info] Starting restoring NuGet packages...
2025-06-18 11:00:13.457 [info] Selected configuration: <Default>, active configuration: Debug|x64
2025-06-18 11:00:13.457 [info] Completed opening a solution (23579ms)
2025-06-18 11:00:13.478 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 11:01:07.842 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (54343ms)
2025-06-18 11:01:07.842 [info] Completed restoring NuGet packages (54348ms)
2025-06-18 11:54:19.139 [info] Starting Query for all projects...
2025-06-18 11:54:19.160 [info] Completed Query for all projects (21ms)
2025-06-18 14:41:58.934 [info] C# Dev Kit deactivate() is now executing...
2025-06-18 14:42:03.760 [info] Starting Spawn .NET server...
2025-06-18 14:42:03.760 [info] Using dotnet resolution provided by ".NET Install Tool".
2025-06-18 14:42:03.764 [info] Starting opening a solution...
2025-06-18 14:42:03.764 [info] Starting processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server...
2025-06-18 14:42:03.859 [info] #getSession: Failed to running method. Error: 'Canceled: Canceled'
2025-06-18 14:42:05.477 [info] Using existing .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
2025-06-18 14:42:05.626 [info] .NET Sdk found: "C:\Program Files\dotnet\dotnet.exe".
2025-06-18 14:42:10.765 [info] .NET server started and IPC established in 5135ms
2025-06-18 14:42:10.791 [info] Completed Spawn .NET server (7039ms)
2025-06-18 14:42:23.417 [info] Completed processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server (19653ms)
2025-06-18 14:42:23.431 [info] Starting restoring NuGet packages...
2025-06-18 14:42:23.432 [info] Selected configuration: <Default>, active configuration: Debug|x64
2025-06-18 14:42:23.432 [info] Completed opening a solution (19667ms)
2025-06-18 14:42:23.450 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:43:03.991 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (40556ms)
2025-06-18 14:43:03.992 [info] Completed restoring NuGet packages (40561ms)
2025-06-18 14:52:04.704 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:52:34.573 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (29875ms)
2025-06-18 14:52:46.595 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:53:36.308 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (49722ms)
2025-06-18 14:53:52.074 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:54:25.908 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (33902ms)
2025-06-18 14:54:26.520 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:54:43.409 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (16894ms)
2025-06-18 14:55:43.282 [info] C# Dev Kit deactivate() is now executing...
2025-06-18 14:55:48.902 [info] Starting Spawn .NET server...
2025-06-18 14:55:48.902 [info] Using dotnet resolution provided by ".NET Install Tool".
2025-06-18 14:55:48.909 [info] Starting opening a solution...
2025-06-18 14:55:48.910 [info] Starting processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server...
2025-06-18 14:55:51.108 [info] Using existing .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
2025-06-18 14:55:51.471 [info] .NET Sdk found: "C:\Program Files\dotnet\dotnet.exe".
2025-06-18 14:55:55.173 [info] .NET server started and IPC established in 3699ms
2025-06-18 14:55:55.188 [info] Completed Spawn .NET server (6290ms)
2025-06-18 14:56:07.353 [info] Completed processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server (18443ms)
2025-06-18 14:56:07.366 [info] Starting restoring NuGet packages...
2025-06-18 14:56:07.367 [info] Selected configuration: <Default>, active configuration: Debug|x64
2025-06-18 14:56:07.367 [info] Completed opening a solution (18457ms)
2025-06-18 14:56:07.381 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 14:56:11.608 [info] Starting Query for all projects...
2025-06-18 14:56:35.507 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (28137ms)
2025-06-18 14:56:35.507 [info] Completed restoring NuGet packages (28141ms)
2025-06-18 14:56:55.396 [info] Completed Query for all projects (43788ms)
2025-06-18 15:31:07.564 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:31:53.064 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (45511ms)
2025-06-18 15:37:22.176 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:38:03.419 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (41266ms)
2025-06-18 15:38:03.443 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:38:50.602 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (47166ms)
2025-06-18 15:38:56.669 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:39:09.096 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (12432ms)
2025-06-18 15:44:32.465 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:44:43.132 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (10675ms)
2025-06-18 15:45:05.035 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:45:18.267 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (13241ms)
2025-06-18 15:53:02.102 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:53:12.327 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (10231ms)
2025-06-18 15:54:39.153 [info] C# Dev Kit deactivate() is now executing...
2025-06-18 15:54:44.727 [info] Starting Spawn .NET server...
2025-06-18 15:54:44.728 [info] Using dotnet resolution provided by ".NET Install Tool".
2025-06-18 15:54:44.766 [info] Starting opening a solution...
2025-06-18 15:54:44.766 [info] Starting processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server...
2025-06-18 15:54:45.020 [info] #getSession: Failed to running method. Error: 'Canceled: Canceled'
2025-06-18 15:54:47.176 [info] Using existing .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
2025-06-18 15:54:47.488 [info] .NET Sdk found: "C:\Program Files\dotnet\dotnet.exe".
2025-06-18 15:54:50.801 [info] .NET server started and IPC established in 3310ms
2025-06-18 15:54:50.819 [info] Completed Spawn .NET server (6094ms)
2025-06-18 15:54:55.031 [info] Completed processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server (10265ms)
2025-06-18 15:54:55.046 [info] Starting restoring NuGet packages...
2025-06-18 15:54:55.047 [info] Selected configuration: <Default>, active configuration: Debug|x64
2025-06-18 15:54:55.047 [info] Completed opening a solution (10281ms)
2025-06-18 15:54:55.070 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 15:55:04.889 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (9833ms)
2025-06-18 15:55:04.889 [info] Completed restoring NuGet packages (9843ms)
2025-06-18 16:08:10.440 [info] C# Dev Kit deactivate() is now executing...
2025-06-18 16:08:15.153 [info] Starting Spawn .NET server...
2025-06-18 16:08:15.153 [info] Using dotnet resolution provided by ".NET Install Tool".
2025-06-18 16:08:15.155 [info] Starting opening a solution...
2025-06-18 16:08:15.155 [info] Starting processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server...
2025-06-18 16:08:15.356 [info] #getSession: Failed to running method. Error: 'Canceled: Canceled'
2025-06-18 16:08:17.168 [info] Using existing .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
2025-06-18 16:08:17.653 [info] .NET Sdk found: "C:\Program Files\dotnet\dotnet.exe".
2025-06-18 16:08:25.907 [info] .NET server started and IPC established in 8252ms
2025-06-18 16:08:25.921 [info] Completed Spawn .NET server (10771ms)
2025-06-18 16:08:35.820 [info] Completed processing the solution file "C:\sources\coes\COES\COES.sln" in Dev Kit server (20665ms)
2025-06-18 16:08:35.902 [info] Starting restoring NuGet packages...
2025-06-18 16:08:35.902 [info] Selected configuration: <Default>, active configuration: Debug|x64
2025-06-18 16:08:35.902 [info] Completed opening a solution (20747ms)
2025-06-18 16:08:35.921 [info] Starting command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive...
2025-06-18 16:09:13.382 [info] Completed command: "C:\Program Files\dotnet\dotnet.exe" restore C:\sources\coes\COES\COES.sln --interactive (37476ms)
2025-06-18 16:09:13.383 [info] Completed restoring NuGet packages (37480ms)

Steps to reproduce

This is a net48 project with mostly unit tests. The templates folder is just data for the unit tests, so we have:

  <ItemGroup>
    <Compile Remove="Features\Templates\**" />
  </ItemGroup>

However, even with this, it gives errors.

Expected behavior

No errors

Actual behavior

Image

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions