Fake attach event ordering

When you attach to a managed debuggee (via ICorDebug::DebugActiveProcess), ICorDebug generates a set of fake events designed to bring the debugger up to the current state. The motivation is that it pumps the debugger just as if the debugger was always attached. Native debugging does the same thing. The list isn’t very well documented, and…


C# app to count #ifdef usage

Here’s a little tool I wrote to count #ifdef usage in a project. It provides a summary of the #define name and frequency; plus a detailed XML file of each location that the #define occurred at. For example, when applied to this sample file (in directory c:\temp\1): 1: void Foo() 2: { 3: #ifdef ABC…


Embed Macros in Help?

Having to meticulously follow detailed instructions is just an accident waiting to happen. Instead of application Help giving such instructions, I wish the Help would just expose Macros to do it for me. I was just using the Help on Application X.  I wanted to create a Widget. I searched through the menus and couldn’t…


Measuring language complexity: Do you need a debugger?

When people are asking for a debugger for language X, practically it means that the usage of language X has gotten sufficiently complicated that mere inspection is insufficient for diagnosing problems. I alluded to this when I said that XML is code.  People want to be able to debug their XML: debug the XSLT transform…


Your feedback: How many types do you ref.emit into a module?

I’m looking for feedback about Ref.Emit usage patterns. When using Ref.Emit, how many types do you generally emit into a single module? Do your scenarios generally use AssemblyBuilderAccess.RunAndSave/.Run? In other words, are you emitting code so that you can immediately execute it in the same process, or are you emitting it for some compiler scenario?…


Interview Tip: Writing test cases

If during a dev interview, you’re asked to write a set of test cases for some function you wrote, be sure to have test cases that reach every basic block. In other words, make sure your test cases at least hit every line of code you wrote. For example, if you need to write ‘bool…


What I’m reading now: "C++ Template Metaprogramming"

I’m currently reading “C++ Template Metaprogramming”. It’s off to a great start. The basic idea (so far) is that: You can write entire algorithms / programs in C++ templates, which are then executed as the compiler instantiates the template.  There is a discipline, structure, organization to these programs. The template programs are generally recursive and…


Patrick Dussud is blogging!

Patrick Dussud, lead architect of the CLR, is blogging (as other CLR members are already pointing out). Patrick has an amazing insight and understanding far beyond myself and many others. (If memory serves, Chris Brumme used to report to Patrick).  If you care at all about the architecture or history of the CLR, you’ll want to…


Random comments about Sytem.Convert class

The System.Convert class is a neat little class in the BCL (mscorlib) for converting between types.  vs. IConvertible: The Convert class is tightly coupled with the IConvertible interface. Convert.ChangeType is just a convenience method to delegate to the IConvertible interface. You can verify this by:- via looking at the IL in reflector- trying it out….


Table of Cool .NET Tools

Here are some cool .NET tools from MSDN / codeplex, complete with Download and tutorial links. Tool Summary Where to get it Links CLR Profiler Easy way to measure memory performance for managed apps. Download for .NET 2.0, .NET 1.1 Tutorial Perf Console Awesome for analyzing performance issues for apps. This makes perf analysis surprisingly…