-
Code generation is a great way to remove the chore of writing and maintaining boiler-plate code. If you're frequently going to be repeating and updating similar code then it's well worth the effort to write a domain-specific language (which can be as simple as an XML schema) and a compiler (which...
-
When you're implementing framework code, annotating it with DebuggerStepThroughAttribute is extremely useful because it instructs the debugger to skip over the method or class it is placed on unless there is an explicit breakpoint in the method. This means that in the majority case where you're...
-
When debugging, it's common to hover over an object to get a quick view of what its properties are. With a single object this is fine because you can easily expand it to view its contents, but when you have a collection of objects it's painful to see the contents as you have to expand every element...
-
In the last two entries about Debug.Assert I looked at why you should use it document your assumptions , and how you can integrate it with your test framework so that tests fail when any of the assertions fail. This time I'll show you how you can use a similar technique to integrate it with your...
-
In the last entry about Debug.Assert I stated that you should document your assumptions using Debug.Assert so that the code fails immediately if any of your assumptions are incorrect. This is really useful when you're doing ad-hoc testing, or you are writing and running your own unit tests to find...
-
From reviewing significant amounts of code over the last few years I have concluded that most people don't use Debug.Assert very much, if at all. I find this surprising because I use Debug.Assert a lot. Used prudently it can reduce bugs in code, make it more self documenting, and as an additional...