C#從零開始_自學C#、Visual Studio實境秀 53/ 使用偵錯工具的技巧和訣竅



53/{使用偵錯工具的技巧和訣竅 https://youtu.be/OtePC39Gwgg

如何問( google )問題{http://bit.ly/2xhgmxh

}

Learn Productivity Tips and Tricks for the Debugger in Visual Studio{http://bit.ly/2wsUNGU

Pin data tips 釘選變量或變數的顯示值

條件式的中斷點 a conditional breakpoint

filter 篩選

物件ID Track an out-of-scope object

You can track the variable by creating an Object ID for it in the Watch window.

Make Object ID

40:40 View return values for functions

To view return values for your functions, look at the functions that appear in the Autos window while you are stepping through your code

Pseudovariables in the Visual Studio debugger{http://bit.ly/2we0GWA

Pseudovariables are terms used to display certain information in a variable window or the QuickWatch dialog box. You can enter a pseudovariable the same way you would enter a normal variable.

}

51:40 Inspect strings in a visualizer 視覺化檢視

When working with strings, it can be helpful to view the entire formatted string. To view a plain text, XML, HTML, or JSON string, click the magnifying glass icon VisualizerIcon while hovering over a variable containing a string value.

56:10 View strings in a string visualizer in Visual Studio{http://bit.ly/2wPcBMu

1:04:40 自訂視覺化檢視 Create Custom Visualizers of Data (C#, Visual Basic){http://bit.ly/2xTlZyI

The Visual Studio debugger includes six standard visualizers.……the WPF Tree visualizer, for displaying the properties of a WPF object visual tree; and the dataset visualizer, which works for DataSet, DataView, and DataTable objects.

1:08:10 寫自己的視覺化檢視 you can write your own visualizers and install them in the Visual Studio debugger.

Overview of custom visualizers

You can write a custom visualizer for an object of any managed class except for Object or Array.

1:14:00 Walkthrough: Writing a Visualizer in C#

等於是自己再寫一個程式來作視覺化檢視器

1:16:20 Create custom views of data in the Visual Studio debugger{http://bit.ly/2gOfvcK

}

}

}

1:21:40 Break into code on handled exceptions

1:29:10 You can configure the debugger to break into code for handled exceptions as well by configuring options in the Exception Settings dialog box. Open this dialog box by choosing Debug > Windows > Exception Settings. 例外狀況設定視窗

Manage exceptions with the debugger in Visual Studio{http://bit.ly/2xRjr3w

1:37:30 When an exception occurs, the debugger writes an exception message to the Output window.

1:41:30 Common Language Runtime Exceptions, meaning .NET exceptions

例外狀況設定視窗恢復預設值 1:54:10 If you would like to restore the exception settings to the defaults, you can click the Restore button on the toolbar:

1:55:20 Tell the debugger to continue on user-unhandled exceptions

2:12:30 Show Columns 顯示資料行 Additional Actions 其他動作

2:02:30 Add and delete exceptions

2:08:00 例外狀況設定是儲存在.suo 檔中的:Exception settings are persisted in the solution's .suo file, so they apply to a particular solution.

2:15:00 泛型的例外狀況類別 :The Exception Settings window supports generic exception types in C# but not in Visual Basic.

2:16:00 條件式的例外狀況  conditional exceptions Add conditions to an exception

2017才開始有此功能 Adding conditions to an exception is new in Visual Studio 2017

}

在例外狀況發生後繼續執行程式:Continuing Execution After an Exception{http://bit.ly/2vSCfCS

2:35:40 例外狀況協助程式的開關:If you have disabled the Exception Helper in the Options dialog box, you will see the Exception Assistant (C# or Visual Basic) or the Exception dialog box (C++).

}

2:42:00 Debug deadlocks and race conditions 多線程、多執行緒的偵錯

If you need to debug the kinds of issues that are common to multithreaded apps, it often helps to view the location of threads while debugging. You can do this easily using the Show Threads in Source button.

2:45:00 To show threads in your source code 「在原始程式檔中顯示執行緒」按鈕

While debugging, click the Show Threads in Source button Show Threads in Source in the Debug toolbar.

2:50:00 Notice that a thread marker may be partially concealed by a breakpoint.

2:51:20 Hover the pointer over the thread marker. A DataTip appears. The DataTip tells you the name and thread ID number for each stopped thread.

You can also view the location of threads in the Parallel Stacks window.

多執行緒的偵錯

2:58:00 Get started debugging a multithreaded application in Visual Studio{http://bit.ly/2xhCzuv

3:02:00 相關的教學 Other topics provide additional information on using other multithreaded debugging tools:

3:12:00 Walkthrough: Debug a Multithreaded Application(Walkthrough: Debugging a Parallel Application in Visual Studio)

3:29:00 Parallel Stacks window 平行堆疊視窗

3:34:00 執行緒視窗 Threads window

3:39:00 加上旗標 Flagging and Unflagging Threads

3:41:40 Parallel Watch window 平行監看式

3:47:00 Freezing and thawing thread execution 凍結、解除凍結(Thaw)

3:50:10 Follow a Single Thread by using Conditional Breakpoints

To follow a thread without freezing other threads, you must avoid breaking into code except on the thread that you are interested in. You can do this by setting a conditional breakpoint.

中斷點設定 Breakpoint Settings window

可對執行緒作命名,因為執行緒ID在每次重新啟動時會變更 You may want to name your threads in your app code (since threads IDs change when you restart the debugger).

4:03:20 切換到另一個執行緒 To switch to another thread, see How to: Switch to Another Thread While Debugging

}

4:20:00 Get more familiar with how the debugger attaches to your app

symbol (.pdb) files

In some scenarios, a little knowledge of symbol files can be helpful. You can examine how Visual Studio loads symbol files using the Modules window.  模組視窗

Open the Modules window while debugging by selecting Debug > Windows > Modules. The Modules window can tell you what modules the debugger is treating as user code, or My Code, and the symbol loading status for the module.

In most scenarios, the debugger automatically finds symbol files for user code, but if you want to step into (or debug) .NET framework code, system code, or third-party library code, extra steps are required to obtain the correct symbol files.

user code 使用者程式碼

You can load symbol information directly from the Modules window by right-clicking and choosing Load Symbols.

Load Symbols 載入符號

To find out how the debugger classifies code as user code, see Just My Code. To find out more about symbol files, see Specify symbol (.pdb) and source files in the Visual Studio debugger.



}

How to add Existing project to a GitHub Repository?{https://youtu.be/OVL7R0eT8jw

2:23:00

}

}


留言

熱門文章