vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Cannot View the Source Code Definitions of csproj ProjectReference Include

Open AndrewDRX opened this issue 1 year ago • 16 comments

Type: Bug

Issue Description

Debugger is always referencing local ProjectReference included project from a metadata file created at [drive]:/Users/[user]/AppData/Local/Temp/MetadataAsSource/[guid]/DecompilationMetadataAsSourceFileProvider/[guid]/[file].

Steps to Reproduce

First symptoms:

  1. Add local project to anoter csproj using a ProjectReference tag.
  2. Add code that references function from included project.
  3. While using debugger, attempt to step into a function from included local project.
  4. Result: Code is always stepped over.

Second symptoms:

  1. Add local project to anoter csproj using a ProjectReference tag.
  2. Add code that references function from included project.
  3. Right-click > "Go to Definition" on function from included project.
  4. Result: Navigates to MetadataAsSource file as mentioned in the the description of this issue.

Expected Behavior

Allow viewing of included project code from original included location, rather than using decompiled MetadataAsSource files.

The expected functionality works on version 1.26.0 of the C# extension for vscode.

This issue appears to have started as early as version 2.0.328 available from the vscode extension marketplace.

Version 2.0.320 showed a different issue where the definitions of the included file could not be found when going to Right-click > "Go to Definition", so this new issue may be related to that issue where it is now creating the MetadataAsSource files so that the definitions can be found, but that does not fix the true issue here of not being able to locate the definitions from the original ProjectReference included file path.

Actual Behavior

See section "Steps to Reproduce".

Environment information

VSCode version: 1.82.2 C# Extension: 2.1.2 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 7.0.401 Commit: eb26aacfec

Runtime Environment: OS Name: Windows OS Version: 10.0.22623 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.401\

Host: Version: 7.0.11 Architecture: x64 Commit: ecb34f85ec

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

.NET runtimes installed: Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 7.0.11 [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

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
blazorwasm-companion ms-dotnettools 1.1.4 ms-dotnettools.blazorwasm-companion-1.1.4
csharp ms-dotnettools 2.1.2 ms-dotnettools.csharp-2.1.2-win32-x64
hexeditor ms-vscode 1.9.12 ms-vscode.hexeditor-1.9.12
powershell ms-vscode 2023.6.0 ms-vscode.powershell-2023.6.0
vscode-dotnet-runtime ms-dotnettools 1.7.3 ms-dotnettools.vscode-dotnet-runtime-1.7.3

Extension version: 2.1.2 VS Code version: Code 1.82.2 (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:55:25.390Z) OS version: Windows_NT x64 10.0.22623 Modes:

System Info
Item Value
CPUs AMD Ryzen 5 3600 6-Core Processor (12 x 3593)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.93GB (8.90GB free)
Process Argv [path] --crash-reporter-id eafc8443-7a05-4e03-8cb9-a0a2d0ad6bbd
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30803844
3biah626:30602489
89544117:30613380
vscrpc:30673769
a9j8j154:30646983
showlangstatbar:30737416
0bi6i642:30835152
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30821571
dsvsc015:30829745

AndrewDRX avatar Sep 15 '23 12:09 AndrewDRX