dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

C# extension should have an equivalent to VS's "No Source" window #1791

Open MikhailArkhipov opened 7 years ago

MikhailArkhipov commented 7 years ago

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information: Version: 2.0.0 Commit SHA-1 hash: cdcd1928c9

Runtime Environment: OS Name: Mac OS X OS Version: 10.12 OS Platform: Darwin RID: osx.10.12-x64 Base Path: /usr/local/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.17.1 C# Extension version: 1.12.1

Steps to reproduce

Compile .NET Core app on Windows with portable debug info

Run it on macOS Attach from VS Code Debugger attaches but cannot find source and there seem to be no way to point debugger to the source location

image

Expected behavior

Ability to open source files like in VS - Attach | Debugger asks where the source is.

Actual behavior

image

gregg-miskelly commented 7 years ago

@MikhailArkhipov You want to https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#source-file-map

gregg-miskelly commented 7 years ago

We don't seem to have an issue tracking improving this experience overall, so I will use this issue to track that feature request. I would like to see us put up a dynamic document here that would have instructions pointing back to an options file, and have the debugger dynamically understand this options file and reload when things change.

In the mean time - use sourceFileMap in launch.json.

MikhailArkhipov commented 7 years ago

Thanks! Yes, docs are sparse :-)

MikhailArkhipov commented 7 years ago

I still have trouble (just got back to the project). First, backslash is not accepted in JSON (you may want to fix C:\ to C:\\ in docs :-). But more important, I tried various combinations to no effect

        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}",
            "sourceFileMap": {
                "Z:\\Work\\RTVS": "/Users/Misha/Work/RTVS",
                "Z:%5CWork%5CRTVS": "/Users/Misha/Work/RTVS",
                "Z:%5CWork%5CRTVS%5Csrc%5CVsCode%5CLanguageServer%5CImpl%5CServer%5CStartup%5C": "/Users/Misha/Work/RTVS/src/VsCode/LanguageServer/Impl/Server/Startup/"
            }
        }

image

gregg-miskelly commented 7 years ago

"Z:\\Work\\RTVS" is what I would recommend.

You are editing the attach configuration. Is that what you are using?

MikhailArkhipov commented 7 years ago

This

Z:\\Work\\RTVS\\src\\VsCode\\LanguageServer\\Impl": "/Users/Misha/Work/RTVS/src/VsCode/LanguageServer/Impl"

works. Go figure :-)

gregg-miskelly commented 7 years ago

Documentation updated. Are you saying things aren't working if you pick something sorter (ex:"Z:\\Work\\RTVS": "/Users/Misha/Work/RTVS")? Or just that it strangely started working again?

gregg-miskelly commented 5 years ago

NOTE: Another reason why this feature would be valuable would be to improve the experience when there is an unhandled exception and no user code on the stack. Currently it is quite confusing.