Omnisharp-vscode: Debugging views of multiple projects in single solution.

Created on 27 Aug 2019  路  13Comments  路  Source: OmniSharp/omnisharp-vscode

Hello,

I have a solution with several asp.net core projects.
I do not find how to indicate in the launch.json files several path for the views (Razor).
(It is a project of partials apps)

Here is the part of the file:

{
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build & prepare",
            "program": "${workspaceRoot}/src/WebApplication/bin/Debug/netcoreapp2.2/WebApplication.dll",
            "args": [],
            "cwd": "${workspaceRoot}/src/WebApplication/",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnFirstSessionStart",
            "launchBrowser": {
                "enabled": true,
                "args": "${auto-detect-url}",
                "runtimeArgs": [
                    "--incognito"
                ],
                "windows": {
                    "command": "cmd.exe",
                    "args": "/C start ${auto-detect-url}"
                },
                "osx": {
                    "command": "open"
                },
                "linux": {
                    "command": "xdg-open"
                }
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "ASPNETCORE_URLS": "https://localhost:5000"
            },
            "sourceFileMap": {
                "/Views": "${workspaceRoot}/src/SoftinuxBase.Security/Views"
            }
        }

Is it possible to debug views of different projects in single solution?
Thanks

Debugger Resolved-External Triaged

All 13 comments

Unfortunately I don't quite understand the question. @NTaylorMullen is this related to the Razor tooling by chance?

@cartermp I have edited the title and added the type of views

Unfortunately I don't quite understand the question. @NTaylorMullen is this related to the Razor tooling by chance?

This (Is it possible to debug views of different projects in single solution?) would actually fall under the .NET Core debugger. /cc @gregg-miskelly

Sadly, I don't know if there is any reasonable way to solve this from the debugger side. VS Code doesn't support searching for source files, so we need to return paths that actually exist on the disk. @NTaylorMullen do you know if there is anyway to control view compilation options so that not all views have PDBs that indicates files are in 'Views', or if you aren't sure, who might be a good contact?

. @NTaylorMullen do you know if there is anyway to control view compilation options so that not all views have PDBs that indicates files are in 'Views'

Sorry, I'm not quite sure I understand the question, probably due to my ignorance in the debugging space (even for Razor files). Could you elaborate?

My problem is simple.

I have a solution with 3 projects:
AT
B
VS

Project A is the entry point (executed project).

Projects B and C are of the partial app type, each containing views (cshtml files)

What is the solution that allows me to put a breakpoint in projects B and C?

Currently, you have to define the view path to be able to debug it.

"sourceFileMap": {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "/ Views": "$ {workspaceRoot} /src/SoftinuxBase.Security/Views"
聽聽聽聽聽聽聽聽聽聽聽聽 }

I would need something like this:

"sourceFileMap": {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "/ Views": "$ {workspaceRoot} /src/SoftinuxBase.Security/Views",
                 "/ Views": "$ {workspaceRoot} /src/SoftinuxBase.Barebone/Views"
聽聽聽聽聽聽聽聽聽聽聽聽 }

@NTaylorMullen This isn't so much a debugger problem as a view compilation problem - when views are compiled, instead of using real source paths, the PDB instead claims that all the source files are in a directory named '/Views'. Do you know if there is an option in view compilation to either disable this redirection to '/Views' or to at least customize them?

@NTaylorMullen This isn't so much a debugger problem as a view compilation problem - when views are compiled, instead of using real source paths, the PDB instead claims that all the source files are in a directory named '/Views'. Do you know if there is an option in view compilation to either disable this redirection to '/Views' or to at least customize them?

Ahhh thanks for the clarification I understand better now. @pranavkm is it possible to change PDB locations at compilation time for our Razor views?

Is this using runtime compilation? The files that RazorSDK generates have the absolute path in them and are compiled by csc.

Yes, runtime compilation. I am guessing some csc option is being used (pathmap?) to change the debug info so that source files claim to be from /Views. It could also be the path added to the #line directives.

It's likely the latter. We might have been deliberately trying to use relative paths for some reason, but it's likely unnecessary seeing that debugger attaches to build time compiled views just fine. I'll go ahead and transfer it to the AspNetCore repo to reconsider this.

@Xarkam, this is a bit of a tangent, but if you are still using the same app as the one in the original issue text, .NET Core 2.2 has been out of support for a while now (https://dotnet.microsoft.com/platform/support/policy/dotnet-core#lifecycle). You should consider switching to a supported release.

This issue was moved to dotnet/aspnetcore#21797

@pranavkm I opened the issue in August 2019. It's been 7 months. I had forgotten about it.
I have since switched to NET Core 3.1

Was this page helpful?
0 / 5 - 0 ratings