0

C# 我从 SlimDX 收到此错误:第一次机会异常 'slimdx.direct3d11.direct3d11 异常'

但我似乎无法弄清楚为什么/在哪里/何时。我已经打开了所有可能的调试,我的 D3D 设备处于调试模式,我启用了非托管调试,我在 DirectX 控制面板等中打开了各种形式的消息传递/中断等。

奇怪的是,当出现这个错误信息时,我的程序一直在完美运行并且没有中断。如果不是输出窗口中的消息,它甚至都不会引人注意。我已经尝试将内容记录到控制台,但很难知道一件事从哪里开始,另一件事在哪里结束,因为我使用了多个线程等。我尝试使用参考设备,但是当我这样做时我的应用程序有点挂起,我已经在 PIX 中运行了它,但是当我这样做时我没有看到任何错误

有点奇怪。如果它能够正常中断,这样我就可以调试它,那就太好了。

有什么想法吗?...

D3D11: INFO: Create InputLayout: Name="unnamed", Addr=0x06C91304, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097264: CREATE_INPUTLAYOUT ]
D3D11: INFO: Create BlendState: Name="unnamed", Addr=0x06C917BC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097270: CREATE_BLENDSTATE ]
D3D11: INFO: Create DepthStencilState: Name="unnamed", Addr=0x06C919AC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097273: CREATE_DEPTHSTENCILSTATE ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C03B64, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create ShaderResourceView: Name="unnamed", Addr=0x06C91DE4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097240: CREATE_SHADERRESOURCEVIEW ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C0401C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create ShaderResourceView: Name="unnamed", Addr=0x06C038EC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097240: CREATE_SHADERRESOURCEVIEW ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C04A34, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create ShaderResourceView: Name="unnamed", Addr=0x06C041F4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097240: CREATE_SHADERRESOURCEVIEW ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C05024, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create ShaderResourceView: Name="unnamed", Addr=0x06C04594, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097240: CREATE_SHADERRESOURCEVIEW ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C04C0C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create ShaderResourceView: Name="unnamed", Addr=0x06C043B4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097240: CREATE_SHADERRESOURCEVIEW ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C00264, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create VertexShader: Name="unnamed", Addr=0x06C004F4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097249: CREATE_VERTEXSHADER ]
D3D11: INFO: Create PixelShader: Name="unnamed", Addr=0x06C008AC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097261: CREATE_PIXELSHADER ]
D3D11: INFO: Create InputLayout: Name="unnamed", Addr=0x06C00C74, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097264: CREATE_INPUTLAYOUT ]
D3D11: INFO: Create RasterizerState: Name="unnamed", Addr=0x06C054C4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097276: CREATE_RASTERIZERSTATE ]
D3D11: INFO: Create Sampler: Name="unnamed", Addr=0x06C05684, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097267: CREATE_SAMPLER ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C05CDC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll
D3D11: INFO: Destroy RenderTargetView: Name="new_ToScreenView", Addr=0x06BEEE44 [ STATE_CREATION INFO #2097245: DESTROY_RENDERTARGETVIEW ]
D3D11: INFO: Destroy Texture2D: Name="new_Swapchain_Texture", Addr=0x06BE9C04 [ STATE_CREATION INFO #2097236: DESTROY_TEXTURE2D ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06C05AFC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create RenderTargetView: Name="unnamed", Addr=0x06BEEE44, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097243: CREATE_RENDERTARGETVIEW ]
D3D11: INFO: Destroy DepthStencilView: Name="unnamed", Addr=0x06BF20D4 [ STATE_CREATION INFO #2097248: DESTROY_DEPTHSTENCILVIEW ]
D3D11: INFO: Destroy Texture2D: Name="D3D_depthStencil", Addr=0x06BEF1B4 [ STATE_CREATION INFO #2097236: DESTROY_TEXTURE2D ]
D3D11: INFO: Create Texture2D: Name="unnamed", Addr=0x06BEF1B4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097234: CREATE_TEXTURE2D ]
D3D11: INFO: Create DepthStencilView: Name="unnamed", Addr=0x06C060AC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097246: CREATE_DEPTHSTENCILVIEW ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x0AC90614, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create VertexShader: Name="unnamed", Addr=0x0AC9086C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097249: CREATE_VERTEXSHADER ]
D3D11: INFO: Create PixelShader: Name="unnamed", Addr=0x0AC90C04, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097261: CREATE_PIXELSHADER ]
D3D11: INFO: Create InputLayout: Name="unnamed", Addr=0x06C0639C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097264: CREATE_INPUTLAYOUT ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C067CC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C06B54, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C06F2C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C07304, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06C07C04, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x0AC9187C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create VertexShader: Name="unnamed", Addr=0x0AC91B0C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097249: CREATE_VERTEXSHADER ]
D3D11: INFO: Create PixelShader: Name="unnamed", Addr=0x0AC91EC4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097261: CREATE_PIXELSHADER ]
D3D11: INFO: Create InputLayout: Name="unnamed", Addr=0x06BF393C, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097264: CREATE_INPUTLAYOUT ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x06BF43EC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: Create Buffer: Name="unnamed", Addr=0x0AC93CB4, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097228: CREATE_BUFFER ]
D3D11: INFO: Create VertexShader: Name="unnamed", Addr=0x0AC93F44, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097249: CREATE_VERTEXSHADER ]
D3D11: INFO: Create PixelShader: Name="unnamed", Addr=0x06BF4CAC, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097261: CREATE_PIXELSHADER ]
D3D11: INFO: Create InputLayout: Name="unnamed", Addr=0x06BF5074, ExtRef=1, IntRef=0 [ STATE_CREATION INFO #2097264: CREATE_INPUTLAYOUT ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D11: INFO: ID3D11DeviceContext::Draw: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll

谢谢

编辑:

添加此代码后,我可以看到更多内容:

AppDomain.CurrentDomain.FirstChanceException += 
    (object source, FirstChanceExceptionEventArgs e) =>
    {
        Console.WriteLine("FirstChanceException event raised in {0}: {1}",
            AppDomain.CurrentDomain.FriendlyName, e.Exception.Message);
    };

现在我看到了:nART.exe 中引发的 FirstChanceException 事件:D3D11_ERROR_FILE_NOT_FOUND:找不到文件(-2005139454)

这可能会让我走上正确的轨道。我现在可以使用断点,我想我已经接近找到罪魁祸首了。

4

1 回答 1

1

您应该能够打开 Debug > Exceptions 并检查“Common Language Runtime Exceptions”“Thrown”,这将中断所有托管库异常的执行,即使它们已被处理。

于 2013-04-17T14:04:10.137 回答