title: Visual Studio Graphics Debugger throws read access violation exception
body: <p>I'm writing a simple renderer using the d3d11 library in Visual Studio 2019 and it builds and runs fine. However when I try running the Graphics Debugger it immediately throws a read access violation for address 0x0000000000000000 ( which is clearly incorrect ).</p>
  
  <p>The exception is thrown from the DXCaptureReplay dll on the line </p>
  
  <pre><code>DeviceContext.PSSetShader(InShaderToBind.Shader.PS, NULL, 1);
  </code></pre>
  
  <p>Where InShaderToBind.Shader.PS is a pointer to ID3D11PixelShader</p>
  
  <p>It got the most weird when I out of a lack of ideas tried</p>
  
  <pre><code>int X = 0;
  ID3D11ClassInstance* FakedClassInstance = reinterpret_cast&lt;ID3D11ClassInstance*&gt;(&amp;X);
  
  DeviceContext.PSSetShader(InShaderToBind.Shader.PS, &amp;FakedClassInstance, 1);
  </code></pre>
  
  <p>As this will make the exception not throw until I try to capture a frame ( Which I guess makes sense as that pointer will only be valid for the scope where X is still valid )</p>
  
  <p>The MSDN documentation states that NULL should be a perfectly valid argument to pass to PSSetShader ( as noted here: <a href="https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-pssetshader" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-pssetshader</a> )</p>
  
  <p>Any ideas for what might be going wrong?</p>
  
  <p>( If I comment out PSSetShader the exception is not thrown and I can take captures )</p>