That's fine.

I think .NET has a method of making a method for execution only in debug, but I can't remember what it is so this is ok. 

More importantly, I think this make the intention clear