dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 669 forks source link

It doesn't recognize ViewModel Folders when it has been set on launch.json on sourceFileMap #4406

Open PontiacGTX opened 3 years ago

PontiacGTX commented 3 years ago

Environment data

dotnet --info output: OS Name: Windows OS Version: 10.0.18363
OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support): Version: 5.0.3 Commit: c636bbdc8a

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

.NET runtimes installed: Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

VS Code version:1.53 C# Extension version: 1.23.9

VS Code Version: 1.53 OS Version: W10 64 bit 1909 Steps to Reproduce:

1.Move MVC's folders to Area folder 2.Change launch.json and include the folders in "sourceFIleMap" "sourceFileMap": { "/Views": "${workspaceFolder}/Area/Views", "/Controllers" : "${workspaceFolder}/Area/Controllers", "/Models":"${workspaceFolder}/Area/Models", "/ViewModels": "${workspaceFolder}/Area/ViewModels",

Does this issue occur when all extensions are disabled?: Yes

OmniSharp log

log.txt

Steps to reproduce

1.Move MVC's folders to Area folder in an ASP.NET Core project 2.Change launch.json and include the folders in "sourceFIleMap" "sourceFileMap": { "/Views": "${workspaceFolder}/Area/Views", "/Controllers" : "${workspaceFolder}/Area/Controllers", "/Models":"${workspaceFolder}/Area/Models", "/ViewModels": "${workspaceFolder}/Area/ViewModels",

Expected behavior

It should recognize the ViewModels folder

Actual behavior

It doesnt recognize the ViewModel folder

gregg-miskelly commented 3 years ago

@PontiacGTX Can you better define what behavior you are seeing? Are you seeing a problem with navigating source files with debugging, or something else? If with debugging: what source file path does VS Code tell you doesn't exist?

For context - the source file map in launch.json will take effect it map source files while debugging. For example, if you set a breakpoint in ${workspaceFolder}/Area/Models/Example.cs, and that breakpoint was hit, the debugger needs to report source file paths back to VS code so that VS code can open the source file. So assuming your map is correct, without a source file map, it will report back /Models/Example.cs. Your source file map should tell the debugger to instead report the real path to the source file so VS Code can open it.