My article in the latest issue of The NT Insider on static analysis tools for driver developers included the following off-hand comment:
We’re not going to discuss SDV in this article because (a) it provides a very different type of analysis from that provided by Code Analysis and Clang-Tidy, and (b) nobody at OSR has been able to get it to work – at all – in VS 2019.
Making VS Static Analysis Tools Work for You (Not Annoy You), The NT Insider, 2020 Issue 1
Well, as soon as our friends in the driver kits static tools group saw this, they sent me an email asking what on earth was up. I told them that neither me nor anybody at OSR has been able to get SDV to run since installing VS 2019 and WDK 2004. Every time anyone here at OSR ran it, we got the lovely surprise you see in Figure 1.
Now, I admit that it was more than a little embarrassing that (a) we couldn’t manage to get SDV to work for us, and (b) we didn’t even bother to send an email to our buddies in the static analysis team to let them know we were having a problem. We had certainly worked with them before to identify and fix static analysis problems. Why didn’t we do it this time? I blame the Coronavirus.
Anyhow… to make a long(ish) story short: After a couple of days, we got the news: We did indeed surface a bug, but it’s one they had seen before, and there’s a very simple work-around.
It seems that if you try to run SDV on a driver project that has “Enable Code Analysis on Build” set to YES, SDV will always fail in the way you see illustrated above. So, the fix is to disable Code Analysis on Build and be sure to save the project to disk. Then run SDV.
Sure enough… that solved our problem.
Yay! We’re now back to happily running SDV on our drivers.
Thank you, SDV team!