December 19th, 2007


For all the XNA programmers or web spiders out there

So, I've been given direction to learn about XNA at work. Which is fine, Microsoft's replacement for DirectX, which is a replacement for WinG, which is a replacement for GDI... Fine.

I got stuff installed at work, which took a long time (by the way, XNA Game Studio 2.0 requires an out of date compiler, so I had to downgrade my compiler to get GS2.0 to install), and went home to try to get my home system(s) up to the same level.

The very first "hello, world"-level program didn't work on my machine. All I had to do was select "New / Project...", select the appropriate boilerplate template, and it should compile and run to create a boring blue-background window. Compile, yes. Run, no.

I got a "System.InvalidOperationException" error when trying to run the most basic of samples. There was no documentation at MSDN, no Google hits for my problem. I did get a hint to pull out my DirectX Caps Viewer tool to see if there was any hint what was going wrong. This was around 1am, well after I had intended to go to bed, so I didn't understand the significance that my primary adapter (of the three I have on this system) didn't have a Hardware Abstraction Layer device inside DirectX Caps Viewer.

When I got up this morning, I recalled that I had turned the hardware acceleration down on that monitor, because for some odd reason, I couldn't get DVDs or some videos to play. Turning the hardware acceleration back up worked around the undocumented behavior.

I'm also writing up a description of the behavior here, which I'm hoping will get caught by Google et al to help out the next guy who tries to get started with XNA and runs into this surprising bit of bad code.