Share via


When comments attack

Another 'ha-ha' moment for you live by;  I've been testing the hybrid driver as individual elements, just to get some error path coverage because I'm weird like that.  That means I was installing the KMDF driver on its own and running unit tests against it, then I was installing the UMDF driver on its own and running unit test against that. 

To do that I had commented out some device initialization elements in the UMDF object.  Primarily the SetFilter(); property.  Not setting that property tells the framework to handle a CreateFile(); request with out sending it down to any subsequent kernel driver...not so good when your KMDF object is a function driver.

This caused a little consternation on my part when I put the two drivers together for the last rounds of testing.  All my request submission from the UMDF driver were being bounced back by the framework with an "invalid handle" error message.  I spent a fair bit of time digging for answers on this problem; some fun debugging, some R rated tirades and such, only to have somebody point out the obvious in the end.  "Did you set the SetFilter(); property?"

So be wary, they may seem like timid, friedly little lines of green code, but comments can also be silent killers...(cue - Theme to Jaws).

 

 

*edit because I just realized I used the same joke twice! *hangs head in shame*