ASP. NET Core 2.0 source code

Source: Internet
Author: User

ASP. NET Core 2.0 source code

In Visual Studio 2017, you can easily debug source code in ASP. NET Core 2.0 with symbols and source links. In this article, we'll focus on how to debug an ASP. NET core source using source links.

What is a source link?

Like me, you may have noticed that the PDB file is created when you compile the code. These files hold symbolic information that can optionally be used to support debugging of external source code. Some types of symbol files may contain some source code or source code mappings.

A long time ago, Microsoft has hosted symbol servers that hold published symbol files for Microsoft products such as. NET Framework and ASP. Visual Studio supports dynamic download symbols. To do this, you must disable the Enable Just My Code option in the General Options, Debug. By default, this option is enabled in Visual Studio.

For more information about symbols, symbol servers, and more, see this MSDN link.

The source link allows you to embed the name and location list of the called method in the symbol file, which identifies the file containing the code and where the file can be retrieved. ASP. NET core, which is not, now supports source links and provides links to managed code on GitHub.

Enable and use source links

The first requirement is to update visual Studio 2017 to the latest version (15.3), which adds support for the source link. If you install this item, in the General Options, debug, you will see Enable source link support.

In addition to ensuring enable only my code is disabled, you must also enable the Microsoft symbol server, and in the Debug, symbols option, you can enable Microsoft symbol server from the list of symbol file locations.

When you enable a symbol server, you need to accept the performance impact that you might introduce when debugging.

When Setup is complete, prepare to debug ASP. NET core source code. To test this, I created a default ASP. NET Core 2.0 MVC project in Visual Studio. Then I HomeController Index added a breakpoint to the method. Then start debugging the application. You may see this message the first time you debug.

This is the symbol file that is being downloaded and may take a while to complete.

Once the application runs to your code breakpoint, you can navigate to the call stack to see all the external ASP code that is executing.

If you double-click any of these calls, the editor uses symbols to determine the frame location where the code is located. Using the links in the symbol file, Visual Studio will download the source files from GitHub. When the source link needs to download the source code, you will see the following warning dialog box:

You can select the first item, download source and Continue debugging option, and continue to use the file for debugging. You can select the second option, download the file, and disable the next file download warning.

After you download the source file, it will appear in the location where you selected the stack.

You can also add your own breakpoints elsewhere in the file, and then set it to hit when you debug your application. Even if we stop debugging and restart, it still seems to be working.

Summarize

Very Nice, it's easy to debug external source code in ASP. With this feature you get more value, so we can debug the ASP. NET core source code to understand how it works internally.

Resources:

    • Debugging ASP. NET Core 2.0 Source Code

Sweet Tang
This address: http://www.cnblogs.com/tdfblog/p/debugging-asp-net-core-2-source.html

ASP. NET Core 2.0 source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.