原文

首先你的VS必须为VS 2017 15.3或以上版本。

打开你的Startup类,在ConfigureServices方法上设置个断点,按F5 Debug应用。
[译]Debug ASP.NET Core 2.0源代码

在Call Stack(调用堆栈)窗口,我们只能看到自己的代码。打开VS tools(工具)->options(选项)对话框选择Debugging(调试),去掉Enable Just My Code(启用“仅我的代码”),然后点击OK。现在Call Stack窗口如下:
[译]Debug ASP.NET Core 2.0源代码

从上看出我们的代码是被Microsoft.AspNetCore.Hosting.dll调用的。

右键Microsoft.AspNetCore.Hosting.dll选择加载Load Symbols
[译]Debug ASP.NET Core 2.0源代码

将出现下面的对话框,这是从Microsoft Symbol Servers上下载symbols。
[译]Debug ASP.NET Core 2.0源代码

右键Microsoft.AspNetCore.Hosting.dll看到Go To Source Code高亮可以选择了。

点击Go To Source Code会弹出一个对话框,供我们选择下载源代码。
[译]Debug ASP.NET Core 2.0源代码

这下可以Debug到Core 2的源代码了。
[译]Debug ASP.NET Core 2.0源代码

相关文章:

  • 2021-07-29
  • 2021-08-09
  • 2021-07-28
  • 2021-05-18
  • 2021-06-28
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2021-09-13
  • 2022-01-23
  • 2021-09-23
  • 2021-06-27
  • 2021-10-02
  • 2021-08-03
相关资源
相似解决方案