DirectX-Graphics-Samples: Hello world crashes when creating swap chain. Access violation

I can’t get these samples to run on my new laptop. I get a crash here at the call to CreateSwapChain: https://github.com/microsoft/DirectX-Graphics-Samples/blob/b5f92e2251ee83db4d4c795b3cba5d470c52eaf8/Samples/Desktop/D3D12HelloWorld/src/HelloTriangle/D3D12HelloTriangle.cpp#L94

The error message doesn’t help me:

Exception thrown at 0x00007FFAEA06B3A7 (d3d12SDKLayers.dll) in D3D12HelloTriangle.exe: 0xC0000005: 
Access violation reading location 0x0000000000000000.

Any idea what that is? Or how I might debug it? I had sample code running on a Microsoft Surface, but when I tried this Asus Zenbook, this happens.

The stack trace in Visual Studio…

 	d3d12SDKLayers.dll!00007ffaea06b3a7()	Unknown
 	d3d12SDKLayers.dll!00007ffaea0636b0()	Unknown
 	d3d12SDKLayers.dll!00007ffaea05893a()	Unknown
 	d3d12SDKLayers.dll!00007ffaea058dc1()	Unknown
 	d3d12SDKLayers.dll!00007ffaea045965()	Unknown
 	dxgi.dll!00007ffb97d42f71()	Unknown
 	dxgi.dll!00007ffb97cf74a1()	Unknown
 	dxgi.dll!00007ffb97cc6d4f()	Unknown
 	dxgi.dll!00007ffb97cc45f7()	Unknown
 	dxgi.dll!00007ffb97cc4159()	Unknown
 	dxgi.dll!00007ffb97cc3ffd()	Unknown
 	dxgi.dll!00007ffb97cc3f11()	Unknown
 	dxgi.dll!00007ffb97cc4c41()	Unknown
 	dxgi.dll!00007ffb97d28f6c()	Unknown
 	dxgi.dll!00007ffb97d28cec()	Unknown
>	D3D12HelloTriangle.exe!D3D12HelloTriangle::LoadPipeline() Line 94	C++
 	D3D12HelloTriangle.exe!D3D12HelloTriangle::OnInit() Line 27	C++
 	D3D12HelloTriangle.exe!Win32Application::Run(DXSample * pSample, HINSTANCE__ * hInstance, int nCmdShow) Line 55	C++

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@walbourn I made some progress. It’s the debug layer triggering it. If I comment out this line, the program runs.

Not a show-stopper anymore, but I’d still like to fix it so I can use the debug layer.

// debugController->EnableDebugLayer();

https://github.com/microsoft/DirectX-Graphics-Samples/blob/b5f92e2251ee83db4d4c795b3cba5d470c52eaf8/Samples/Desktop/D3D12HelloWorld/src/HelloTriangle/D3D12HelloTriangle.cpp#L42