[英]How can i find what cause a null exception ? I mean what line or where in the code the exception throw?
我正在運行我的程序,一段時間后它會拋出此異常:
我在程序中使用DirectX,在我做的表單的頂部也使用了Direct3D:
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;
我在程序中使用Direct3D.Sprite和Device and Texture PresentParameters和DisplayMode都連接到DirectX.Direct3D
在異常消息中,它說的是有關OnLostDevice()和其他內容的信息。 但是它沒有給出任何特定的行,也沒有給出代碼在哪里出現問題。
有什么辦法可以找到導致問題的原因?
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Microsoft.DirectX.Direct3DX
StackTrace:
at Microsoft.DirectX.Direct3D.Sprite.OnLostDevice()
at Microsoft.DirectX.Direct3D.Sprite.OnParentLost(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.DirectX.Direct3D.Device.raise_DeviceLost(Object i1, EventArgs i2)
at Microsoft.DirectX.Direct3D.Device.Finalize()
InnerException:
首先,將項目的Configuration
置於Debug
。 目前,您正在Release
! 在屏幕截圖中,您可以在“ Continue
按鈕中看到它。 之后,您應該Debug
您的項目。
在Debug中時,選中Debug/Exceptions/Common Language Runtime Exceptions
的復選框,可以看到拋出異常的確切行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.