![]() ![]() When working with strings, it can be helpful to view the entire formatted string. You can also use pseudovariables in the Watch and Immediate window, such as $ReturnValue. (Open it using Debug > Windows > Immediate.) In addition, you can enter functions in the Immediate window to view return values. If the window is closed, use Debug > Windows > Autos to open the Autos window. To see the return value for a function, make sure that the function you are interested in has already executed (press F10 once if you are currently stopped on the function call). To view return values for your functions, look at the functions that appear in the Autos window while you are stepping through your code. Right-click the object ID variable and choose Add Watch.įor more information, see Create an Object ID. You should see a $ plus a number in the Locals window. ![]() Start the debugger ( F5) and stop at the breakpoint.įind the variable in the Locals window ( Debug > Windows > Locals), right-click the variable, and select Make Object ID. Set a breakpoint near a variable that you want to track. You can track the variable by creating an Object ID for it in the Watch window. In some app scenarios, the value of a variable may change even when the variable is out of scope, and you might want to watch it closely (for example, a variable may get garbage collected). However, when a variable goes out of scope in the Watch window, you may notice that it is grayed out. It's easy to view variables using debugger windows like the Watch window. Track an out-of-scope object (C#, Visual Basic) If no matches are found, or if several processes have the same name, the Attach to Process dialog box will open so you can select the correct process. When you choose this command, the debugger will immediately try to attach to the last process you attached to by first attempting to match the previous process ID and if that fails, by matching to the previous process name. When you are using the attach to process feature, you can quickly reattach to a process that you were previously attached to by choosing Debug > Reattach to Process ( Shift+ Alt+ P). Attach to the same application repeatedly For C++ code, you can do the same using Natvis visualizations. If you are interested in another type of condition, select Filter instead of Conditional expression in the Breakpoint Settings dialog box, and then follow the filter tips.Ĭonfigure the data to show in the debuggerįor C#, Visual Basic, and C++ (C++/CLI code only), you can tell the debugger what information to show using the DebuggerDisplay attribute. In the Breakpoint Settings window, type an expression. Right-click a breakpoint icon (the red sphere) and choose Conditions. You can set conditions using expressions, filters, hit counts, and so on. You can use conditional breakpoints and filter breakpoints to avoid breaking into your app code until the app enters a desired state (such as a state in which a variable is storing bad data). If it is difficult or time-consuming to recreate a particular state in your app, consider whether the use of a conditional breakpoint can help. To modify XAML code during a debugging session, see Write and debug running XAML code with XAML Hot Reload. ![]() To use this feature, click into your code with your cursor while paused in the debugger, make edits, and press F5, F10, or F11 to continue debugging.įor more information on using the feature and on feature limitations, see Edit and Continue. In most languages supported by Visual Studio, you can edit your code in the middle of a debugging session and continue debugging. Edit your code and continue debugging (C#, VB, C++) For more information, see View data values in DataTips in the code editor. You can also customize data tips in several other ways, such as keeping a data tip expanded (a sticky data tip), or making a data tip transparent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |