ICorDebug, Edit-and-Continue, and C#

In case anybody missed it, VS 2005 C# is going support Edit-and-Continue! (See announcement, and some follow up posts by the C# team from Andy and Steve).


The CLR is a language-neutral platform. So naturally, our debugging API (ICorDebug) operates at the IL level so that it can be language-neutral as well. The Edit-and-Continue support in the debugging API is language-neutral, though it was mainly designed to ensure that key VB scenarios worked.   


In theory, any 3rd party could write their own managed debugger and support EnC for their own languages ([Update]: see here for how a 3rd-party can support EnC).  The C# team put this to the test because they did EnC without any additional modifications to ICorDebug.


Comments (13)

  1. BillT says:

    I encourage you (and you colleagues) to write articles about exactly how "any 3rd party could write and support EnC". Perhaps a step-by-step covering each main idea up to and including supports stepping and watchpoints.

    I, for one, would love to see such content.

    (Perhaps this content would even make a good candidate for a follow-on book for "Build Your Own .NET Language and Compiler" in collaboration with it’s author, Edward G. Nilges.

  2. BillT says:

    [ Pardon the earlier typos. I meant "your colleagues" and "including support for". I must be tired. 6:18 AM here. ]

  3. Mike Stall says:

    BillT – are you thinking of writing your own enc-cabable debugger?

    I’ll add it to my blog todo list. Thanks for the suggestions.

    FWIW, MDbg has a very primitive demo of the interfaces, but we recognize it’s not nearly enough to infer a complete solution.

  4. Eric Newton says:

    I knew that enabling EnC in VB.Net would mean that C# should be able to benefit from it as well, since the CLR is the actual "execution engine" and the execution engine is what has to support inserting a new snippet of IL to replace the current IL.

    That’s why I was all over the C# team when they said that they "didnt have enough time" to do it…

    Frankly I am ecstatic that they decided to make time for it, since typically all the refactoring in the world will never save as much time as being able to change just a minor bug during debugging.

    Kudos to the C# team for listening to the community and making EnC a reality!

  5. Mike Stall says:

    Kudos indeed to the C# team!

    It was practically no extra work from the CLR end (since we’re language neutral), but I need to point out that the language-services actually did have a bunch of work needed to make a language EnC-capable.

  6. Edward G. Nilges says:

    Well, if parsing front end is important, then my book is useful. I suppose that in debugging scenarios the debugger would need to parse complex expressions, but my book intentionally skimps on code generation.

    Its primary mission is to show that there’s a body of well-established theory out there which programmers can use in the front end of any parser, and that they don’t have to either develop their own theory or use a "tool" which is hard to manage because it does its own thing.

    But to work with EnC you need depth also in CLR and code generation, to which only a chapter is devoted in my book.

  7. Mike Stall says:

    Edward – I’d venture that codegeneration for EnC is not more complicated than cg for non-EnC. The CLR + Jit try to shoulder the bulk of the burden and the compiler just has to spew the same high-level IL it always does. Now it may have to emit certain constructs in a slightly different fashion, but I don’t expect anything significant. (That said, I don’t actually have to write the compilers … )

  8. Native-only debugging allows you to debug child processes. In other words, you can debug process A, and…

  9. Native-only debugging allows you to debug child processes. In other words, you can debug process A, and…

  10. Native-only debugging allows you to debug child processes. In other words, you can debug process A, and…

  11. Here are some random software things I use that really change how I work.

    OneNote: Word is not a…