Visual Studio 2017 Community Graphics Debugging

Has anyone succeeded in using Visual Studio 2017 Community Graphics Debugging/Diagnostics to debug shaders etc. with a MonoGame project?

I am following this guide:
https://forum.unity3d.com/threads/debugging-shaders-in-visual-studio.322186/
but get some exceptions when debugging starts…

I managed to capture a frame now.
To make it run, I had to enter a path in Debugging->Working Directory too.

As usual, shader source code is not available to debug right off the bat.

I tried compiling the effects file .fx in Debug mode with the pipeline tool. Still, it says “Source not available” when I try to debug the pixel shader.

The guide says to include the line
#pragma enable_d3d11_debug_symbols
directly in the shader - is this relevant for MonoGame too?

That should work, because MG passes the shader to the D3D compiler after removing the Effects framework stuff (like sampler state in the shader, techniques and semantics).

If I build the game in Release mode and try to debug it using the Graphics Debugger, will that strip debug information from the shaders?
I can’t seem to run the Debug version of the game in the Graphics Debugger right now without it crashing…

If you build your shaders using the Pipeline Tool, there is a property that says if they should be built with the Debug flag. It is set to “Auto” by default, but you can force the Debug flag by changing it to “Debug”.

Is win10 still needed to use this?

I can’t find the place where you can debug shader draws to a rendertarget. Only shader draws to the back buffer seem to allow debugging…

I have never gotten live shader debugging with uncompiled code to work with monogame.

For frame breakdown/debugging I can recommend intel GPA and renderdoc over the vs solution

Just marking this thread so I can remember it in the morning. I’ll update this comment With steps if i get it working.

I can confirm that this is the important step - I didn’t need the #pragma.
I found, however, that a lot of the shaders were still obfuscated. They showed up as lists of includes. This might be particular to our project, which was an old xna project.
I’m now looking into debugging them through nSight, but I suspect I’ll have similar results.