Dot-Net

PDB 在調試時給了我什麼,我怎麼知道它在工作?

  • April 15, 2010

我必須使用沒有原始碼的第三方組件。我有發布 DLL 和發布 PDB 文件。我們稱它為“CorporateComponent.dll”。我自己的程式碼從此 DLL 創建對象並呼叫這些對象的方法。

CorpObject o = new CorpObject();
Int32 result = o.DoSomethingLousy();

調試時,“DoSomethingLousy”方法會引發異常。PDB 文件對我有什麼作用?如果它做得很好,我怎麼能確定我正在使用它?

要確認您是否在使用提供的 PDB,CorporateComponent.pdb,在 Visual Studio IDE 中進行調試期間,請查看輸出視窗並找到指示 CorporateComponent.dll 已載入併後跟字元串的行Symbols loaded

從我的一個項目中說明:

The thread 0x6a0 has exited with code 0 (0x0).
The thread 0x1f78 has exited with code 0 (0x0).
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug  \AvayaConfigurationService.exe', Symbols loaded.
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug\IPOConfigService.dll', No symbols loaded.

Loaded 'C:\Development\src...\bin\Debug\AvayaConfigurationService.exe', Symbols loaded.

這表明 IDE 調試器找到並載入了 PDB。

正如其他人所指出的 在檢查應用程序中的堆棧幀時,您應該能夠看到 CorporateComponent.pdb 中的符號。如果您不這樣做,那麼第三方可能沒有在發布 PDB 建構中包含符號資訊。

引用自:https://stackoverflow.com/questions/52600