VS code debugging. NET Core

Source: Internet
Author: User

VS code debugging. NET Core applications The pits that are encountered why there is a "pit"

There are a lot of blog parks that describe how to use vs Code and Debug. NET core articles, but are all based on the direct build of ASP.

(1). The pit we encountered this time is encountered in a multi-project solution , which means that the root directory is not a project directory;

(2). Debug project cannot load symbol file, cause project cannot debug breakpoint ;

Troubleshooting issues 1. Directory Issues with Solutions

Modify the "program" node in Launch.json:

Program: "${workspaceroot}", Workspaceroot is the solution directory, modify this value to "${workspaceroot}/subproject directory/bin/debug/netcoreapp1.0/ < project name >.dll "

  After the modification, debug found no way to build, prompting couldn ' t find ' Project.json ' in the current directory.

In fact, the reason is the same is not found in the project directory caused by, modify the Tasks.json file:

Add an Options node for it:

{    //See https://go.microsoft.com/fwlink/? linkid=733558    //For the documentation about the Tasks.json format    "version": "0.1.0",    "command": "Dotnet",    "Isshellcommand": True,    "args": [],    "Options": {        "CWD": "${workspaceroot}/sub-project directory"    },     "Tasks": [        {            "taskname": "Build",            "args": [],            "Isbuildcommand": True,            " Showoutput ":" Silent ",            " Problemmatcher ":" $msCompile "        }    ]}

The CWD node of the options, which specifies the working directory of the dotnet command line, can be modified to build normally.

2. Debug not Breakpoint debugging

Looking at log, you will be prompted with the following information when debugging:

Could not load symbols for ' *.dll '. ' *.pdb ' is a Windows pdb. These is not supported by the Cross-platform. NET Core Debugger.

Probably means that a symbol file generated under Windows cannot be loaded by a cross-platform debugger.

The solution is simple, in each project file (Project.json) that needs to be debugged, add a node information as follows:

  "Buildoptions": {    "debugtype": "Portable"  }
Project.json

This is a project.json fragment of an YOYOFX open source framework project.

YOYOFX Frame

GITHUB:HTTPS://GITHUB.COM/MAXZHANG1985/YOYOFX Star, Welcome to the exchange.

YOYOFX is a lightweight for building HTTP-based WEB services based on the. NET and Mono platforms.

VS code debugging. NET Core

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.