Mike Stall's .NET Debugging Blog

Notes on Managed Debugging, ICorDebug, and random .NET stuff

Browse by Tags

Tagged Content List
  • Blog Post: Stuff in Reflection that's not in Metadata

    Previously, I mentioned some things in Metadata that aren't exposed in Reflection . Here's an opposite case. While metadata represents static bits on disk, Reflection operates in a live process with access to the CLR's loader. So reflection can represent things the CLR loader and type system may do that...
  • Blog Post: Codegen for On Error Resume Next

    VB has a " On Error Resume Next ", which tells each line to swallow exceptions and just keep executing to the next line. It's kind of like a try-catch around every single line. It may be tempting for C++ developers to make fun of VB for this, but this is a lot like programming with HRESULT (or any error...
  • Blog Post: Things in Metadata that are missing in Reflection

    System.Reflection is a high-level way of describing Types in .NET targetted at managed code consumers. The API is easy to use, but does not expose all the information that's actually present and affecting decisions. For example, Reflection does not expose TypeRef , MemberRef, AssemblyRef, or other Ref...
  • Blog Post: Return vs. Finally (2)

    The Return statement and finally have competition. Both can are the "last" thing to execute when a function exits, so which of them is really last? I blogged about this before regarding C#'s semantics setting data. Now I'll compare some interesting differences between C# and Python . Who wins if you...
  • Blog Post: Quiz: What runs before Main()?

    Quiz: What managed code runs before managed Main() in your program startup path? Answers : I note "managed code", because obviously the CLR startup code gets executed, as does other native startup code. 1) The common answer is static constructors referenced from Main(). 2) The less common answer would...
  • Blog Post: Why debugging breaks in optimized (production) builds.

    You may have noticed that debugging optimized builds (eg, what you commonly get when you attach to a end-user instance of your app that wasn't launched from your debugging environment) is usually a degraded experience. At an architectural level, there's a fundamental tension between being debuggable...
  • Blog Post: Techniques for Debugging IL

    I mentioned in the recent dev lab that you can debug at the IL level . I demoed two ways to do this, and here I wanted to compare them more thoroughly. The big thing that's missing is that while you can do IL level stepping, you can't view the IL evaluation stack. 1) Rewriting the PDBs : It's common...
  • Blog Post: TypeDef vs. TypeRef

    Many of the .NET docs use the phrase "TypeDef or TypeRef". What's the difference? Both refer to metadata tokens. Each token has a scope for resolving the token, which basically corresponds to a module (a .dll or .exe). IMetaDataImport is the interface for reading metadata from a module. A TypeDef refers...
  • Blog Post: 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...
  • Blog Post: Using Foo<T>(...) instead of Foo(System.Type, ...)

    Whenever you're passing in a parameter of System.Type that is usually determined at compile-time, consider having a version with a generic parameter. This converts runtime checks into compile time checks, may let you have more efficient code, and likely lets you get rid of ugly casts. For example...
  • Blog Post: Resolving functions and func-eval syntax

    I got a question about MDbg's func-eval syntax, which brings up a nice point about function resolution: Is it possible to evaluate a function by specifying an instance variable instead of the fully qualified name of the class? f ex.get_StackTrace ... is so much nicer than ... System.Exception...
  • Blog Post: Debugabbility with Roundtripping Assemblies

    I've gotten several questions about debugabbility IL round-tripping. Round-tripping is where you decompile an app (perhaps via ILDasm), potentially edit the IL, and then recompile it (perhaps via ILAsm). This is the backbone for rewriting an assembly, it's what my Inline IL tool does, and I notice Dotfuscator...
  • Blog Post: Presentation on AOP + Debuggability

    Today I gave a presentation on AOP + debuggability on .NET as part of Microsoft's AOP workshop ( http://research.microsoft.com/workshops/aop/ ). The presentation is available online here (it's power point). The deck has some bonus slides that I didn't show in the live presentation; and some of the slides...
  • Blog Post: AOP and Debuggability

    I'll be giving a short presentation at an upcoming Microsoft workshop on Aspect Oriented Programming on .NET. More information about the workshop is here: http://research.microsoft.com/workshops/aop/ I don't know much about AOP, but I do know a thing or two about debugging infrastructure, and that...
  • Blog Post: Compiling a language to C#

    Several people have written me to say that they're writing their own language (let's say 'X') and they compile their language to C# and then compile C# to IL. This is instead of directly compiling X to IL. This can be attractive because: 1) using C# constructs may simplify the code-gen for X. For example...
  • Blog Post: Having debugger-friendly codegen

    One of the things I like about C# anonymous delegates is that the codegen is clever enough that they're reasonably debuggable without any additional debugger support. This type of debugger-friendly codegen is a key part in making your 3rd-party language debuggable by existing debuggers . Consider...
  • Blog Post: MC++ / IJW codegen for Native structures in IL

    When MC++ compiles an "unmanaged" class into IL (from IJW), it actually compiles the class into an opaque blob and then uses pointer arithmetic to access the fields. The code is not verifiable, but it's still IL. This is exactly how it would codegen if the class were compiled to native code. Consider...
  • Blog Post: Managed C++ codegen for new, array manipulation, delete

    Managed C++ (MC++) code generation is a cool accomplishment. I think it's another good testimony to the CLR's cross-language charter (and IL's flexibility) that we can support C++. (Not too mention our support for more dynamic languages like F# , SML.Net , and IronPython that also compile to IL) As the...
Page 1 of 1 (18 items)