dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 673 forks source link

Failed download source code file when debugging . #5214

Open qslcna opened 2 years ago

qslcna commented 2 years ago

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   5.0.403
 Commit:    bf9d168ac2

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.403/

Host (useful for support):
  Version: 5.0.12
  Commit:  7211aa01b3

.NET SDKs installed:
  5.0.403 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version: C# Extension version:

v1.24.4

OmniSharp log

Starting OmniSharp server at 5/16/2022, 1:55:48 AM
    Target: /home/qishuo/repos/PocketWeb/Pocket.sln

OmniSharp server started.
    Path: /home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/run
    PID: 25024

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 20.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 17.1.1 - "/home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 17.1.1 - "/home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /home/qishuo/.vscode-server/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/qishuo/repos/PocketWeb'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/qishuo/repos/PocketWeb/Pocket.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/qishuo/repos/PocketWeb/Web/Web.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/qishuo/repos/PocketWeb'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/qishuo/repos/PocketWeb' on host 24933.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/qishuo/repos/PocketWeb/Web/Web.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/qishuo/repos/PocketWeb/Web/Web.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/qishuo/repos/PocketWeb/Web/Web.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Web
Received response for /v2/getcodeactions but could not find request.
Received response for /quickinfo but could not find request.

Steps to reproduce

  1. flow this Debugging-into-the-.NET-Framework-itself to config lauch.json.
  2. press F5 to lauch debug my asp.net core project.
  3. set breakpoint and step into it.
  4. See error

Expected behavior

the source file of List.cs

Actual behavior

  // 在此计算机上找不到源文件
  // /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs。此源文件模块的
  // PDB 包含要通过源链接下载源文件的信息,但调试器请求下载此源文件失败。
  // 
  // 请求失败: Connection refused (raw.githubusercontent.com:443) Connection refused
  // 
  // 将从中下载源文件的 URL:
  // https://raw.githubusercontent.com/dotnet/runtime/7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs
  // 
  // 有关源链接和 VS Code 的详细信息,请参阅: https://aka.ms/VSCode-DotNet-SourceLink

Additional context

this is absolutely a network issue. Because the browser also can't open this link without proxy.

https://raw.githubusercontent.com/dotnet/runtime/7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs

how to make omnisharp-vscode download source code through proxy.

qslcna commented 2 years ago

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    // https://github.com/omnisharp/omnisharp-vscode/blob/master/debugger-launchjson.md
    // https://github.com/OmniSharp/omnisharp-vscode/wiki/Debugging-into-the-.NET-Framework-itself
    "version": "0.2.0",
    "configurations": [{
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/Web/bin/Debug/net5.0/Web.dll",
            "args": [],
            "cwd": "${workspaceFolder}/Web",
            "stopAtEntry": false,
            "serverReadyAction": {
                "action": "openExternally",
                "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "COMPlus_ZapDisable": "1",
                "COMPlus_ReadyToRun": "0",
            },
            "sourceFileMap": {
                "/Views": "${workspaceFolder}/Views"
            },
            "justMyCode": false,
            "symbolOptions": {
                "searchMicrosoftSymbolServer": true,
                "searchNuGetOrgSymbolServer": true
            },
            "suppressJITOptimizations": true,
            "sourceLinkOptions": {
                "https://raw.githubusercontent.com/*": {
                    "enabled": true
                },
                "*": {
                    "enabled": false
                }
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ]
}
qslcna commented 2 years ago

I have try :

not working:(