search
HomeBackend DevelopmentC#.Net TutorialLittle features you don't know about in Visual Studio Debugger

This article mainly introduces seven little-known small functions of Visual Studio Debugger in detail, which has certain reference value. Interested friends can refer to it

Visual Studio debugger is a Great debugging tools that can help programmers quickly find and solve problems. Here is a brief introduction to seven little-known functions in the VS debugging tool.

1. Jump to the specified statement with one click

During debugging, you often need to drag the yellow arrow to execute or not execute a specific statement. The conventional method is to use the mouse to drag directly.

In the Visual Studio 2017 15.3 preview version, there is a simpler way to jump to the target row: hover the mouse pointer on the target row, and when the green vertical line right arrow icon appears, hold down CTRL and click the mouse left Click the button to move the debugging yellow arrow, and then click Debugging Next or F5 to run directly on the specified line.

2. Add a breakpoint for the specified instance value

Sometimes the attribute value of an instance will change inexplicably. When we need to know why it changes, we will add a breakpoint in the attribute code, but this will take effect on all instances.

When debugging, you can use the Make Object ID and Conditional Breakpoint functions to add breakpoints for specified instances, as follows:

First I defined a class, And initialized two objects, changed the value of PointX, and wanted to add a change breakpoint of the PointX value of instance a

During the debugging process, Right-click instance a and select Make Object ID

##At this time instance a is assigned to $1, right-click on the breakpoint to be added and select Conditions...

After adding $1 == this code, and then running the program, the breakpoint will take effect when the properties of instance a change, but will not take effect when the properties of instance b change.

Note that Make Object ID records the address of the object in memory. It will change the next time you debug and needs to be reset.

3. Reattach process

Attach to Process is a function that everyone often needs to use. There is a new option in Visual Studio 2017 called Reattach to Process, which can be convenient Everyone reattaches to the process they were last attached to.

First attach to a process, click Stop Debugging, and then click Debug to see the Reattach to Process option inside.

4. Show all threads

During the debugging process, there is a new option in the debugging toolbar called: Show Threads in Source. After clicking, an icon will be displayed in front of the line of code where the thread is stopped. When the mouse stays on the icon, the thread will be displayed. Right-click the icon to display the available operations.

Note that this function may affect debugging efficiency. It is recommended to turn it off by default if it is not needed.

5. Temporarily disable specified breakpoints

When performing multi-thread debugging, you can use the Disable Breakpoint function to temporarily disable specified breakpoints to prevent

otherThe thread is interrupted due to a breakpoint, which affects the debugging work of the current thread.

6. View the call stacks of all threads

During debugging, in Command Enter "Debug.ListCallStack -AllThreads" in Window to see the call stacks of all threads.

You can also use the WinDBG command "~*k":

7. No negative effects when used Method evaluation

Sometimes you may need to view the return value of a method in the debugging Watch window, but when this method is actually executed, it may have negative effects. Here you can add ", nse" when inputting in the Watch window to avoid negative effects. It is the abbreviation of "No Side Effects". The example is as follows:

Add was executed six times at the beginning, so the total number of testList is 6.

Now if you want to view the return value of Add’s current execution, you can Enter Add(1) in the Watch window, but this will have a negative impact, changing the value of testList to 7,

So if you want not to affect the original value of testList, you need to add On ", nse", the following display is 8, but the original value of testList has not changed and is still 7:

The introduction ends here. Do you have any small debugging functions you like? Welcome Come and comment~

PS: It’s just an introduction, don’t comment if you don’t like it.

The above is the detailed content of Little features you don't know about in Visual Studio Debugger. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Windows 11 是否提供对 VB6 应用程序的支持?Windows 11 是否提供对 VB6 应用程序的支持?May 30, 2023 am 08:31 AM

Windows11引入了更多macOS风格的UI元素。您将获得重新设计的任务栏,开始菜单位于中心。是的,您可以更改它的位置,但默认情况下,它将放置在中心。控制中心还进行了一些设计调整。在下一次更新中,对Android应用程序的支持也将与重新设计的记事本和媒体播放器一起提供。尽管所有这些功能都使Windows11比Windows10有了不错的升级,但用户的脑海中正在酝酿某些疑虑。有一部分用户和开发人员担心Windows11是否会支持遗留应用程序和技术,无论是否落后。由于V

如何修复 VCRUNTIME140.dll 在 Windows 上丢失错误如何修复 VCRUNTIME140.dll 在 Windows 上丢失错误May 04, 2023 am 08:04 AM

VCRUNTIME140.dllismissing错误是您在Windows上的VisualC++Redistributable文件存在问题。您可以使用本教程解决问题。Windows应用程序和软件需要DLL文件才能运行——没有它们,它们可能会完全停止工作。例如,如果您看到VCRUNTIME140.dllismissing错误,这表明您的PC缺少此文件,从而阻止应用程序启动。这可能是由于应用程序安装不成功。它甚至可以在运行Windows更新后出现。值得庆幸的是,您可以很容易

4 修复 CONCRT140.dll 未找到错误的方法4 修复 CONCRT140.dll 未找到错误的方法Apr 25, 2023 am 09:22 AM

如此多的用户报告说,每当他们尝试运行应用程序时,它都会抛出一条错误消息,指出代码执行无法继续,因为未找到CONCRT140.dll。在打开Adob​​e应用程序、Halo、ForzaHorizo​​n5等时,您可能会遇到找不到CONCRT140.dll。因此,这不是特定于某个应用程序的问题。如果没有安装正确的DLL,应用程序将无法正常工作,因为它们的代码依赖于这些库中编写的代码。在本文中,我们将了解CONCRT140.dll是什么以及它丢失的原因,以及我们如何下载它并修复错误。什么是

修复:Microsoft Visual C++ 2015 Redistributable Setup Failed 错误 0x80240017修复:Microsoft Visual C++ 2015 Redistributable Setup Failed 错误 0x80240017Apr 18, 2023 pm 01:07 PM

MicrosoftVisualC++已成为运行大多数常见应用程序所需的Windows操作系统的组成部分。现在,一些用户最近抱怨他们在尝试安装VisualC++RedistributablePackagesfor2015或MicrosoftVisualStudioRedistributablePackagesfor2013时遇到的问题。根据这些用户的说法,安装程序中途停止并显示“0x80240017-未指定错误”.这次失败的背后可能有很多原因。因此,不要在此

微软发布 Visual Studio 2022 17.3,这里是亮点微软发布 Visual Studio 2022 17.3,这里是亮点Apr 28, 2023 am 10:28 AM

微软发布了VisualStudio202217.3。此更新带来了对.NET多平台应用程序UI(.NETMAUI)的支持、为MicrosoftTeams开发应用程序的能力、C++改进、Azure容器应用程序以及改进的LiveUnitTesting。您可以通过打开VisualStudio中的帮助>新增功能来查看新功能的完整列表。此更新中的主要功能是.NETMAUI已从预览支持中毕业,现在可在Windows上的VisualStudio2022

Visual Studio 2022 for Mac 17.0 附带原生 macOS UI 和 Apple Silicon 支持Visual Studio 2022 for Mac 17.0 附带原生 macOS UI 和 Apple Silicon 支持Apr 15, 2023 am 08:04 AM

微软 已宣布Visual Studio 2022 for Mac 17.0的一般版本。它带来了巨大的变化,包括原生 macOS UI 和对 Apple Silicon 处理器的支持。据该公司称,它还发布了一个新的预览版,您可以与此版本并排安装。在旧版本的 Visual Studio for Mac 中,Microsoft使用了各种 UI 技术,这让事情看起来格格不入。此更新使用

android studio如何实现上传图片到java服务器android studio如何实现上传图片到java服务器Apr 28, 2023 pm 09:07 PM

1.build.gradle配置(增加)dependencies{implementation'com.squareup.okhttp3:okhttp:4.9.0'implementation'org.conscrypt:conscrypt-android:2.5.1'}2.AndroidManifest.xml配置权限在application里面添加android:usesCleartextTraffic="true&q

Android Studio无法执行Java类的main方法怎么解决Android Studio无法执行Java类的main方法怎么解决May 17, 2023 pm 04:43 PM

环境androidstudio版本:3.6.1gradle版本:5.6.4gradle插件版本:3.6.1错误提示11:41:35PM:Executingtask'TxtUtil.main()'...Executingtasks:[TxtUtil.main()]inproject/Users/tinytongtong/Documents/workspace/as/self/BlogDemoFAILURE:Buildfailedwithanexception.*Wh

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!