Whenever I have to write a large project using CodeDom (and this doesn't happen as often as you'd think), I almost always find something lacking. It's as if the whole of CodeDom is half baked.

What's bugging me the most is that even with the framework's latest version, 2.0, when Microsoft had the chance to fix things up, they decided, for reasons unknown to anyone outside the company to only implement the new features and fix very few bugs.
Microsoft developers, on their blogs, keep saying that they want not only software to be built with the framework, but also tools. One of the greatest tool-making capabilities they placed in the framework is CodeDom and I'm very appreciative of it, but when such a feature lacks in so many areas, it in several occasions becomes unusable.

What brought this on? Here are the two latest bugs I found and reported:
  1. CodeDom Does Not Allow For Creation of ParamArrays.
  2. CodeDom Does Not Allow For Creation of Finalizers (Destructors).
(Previously, and then some, and then some more, and one more to boot)


  • I've got another CodeDom bug for you. I just stumbled over it, while trying to generate code from a DSL using CodeDom: Both the C# and VB code generators do not support the sealed (NotOverridable) keyword on methods. I was trying to create a sealed override from a base class. Both code generators even turn the override into a new virtual method.

    Besides: I really dislike the way MemberAttributes are specified. This should've been splitted into seperate properties/enums.


  • I think I even opened a bug about that once. Can't remember what with all of the bugs I opened for CodeDom... :/

    re: MemberAttribute: Couldn't agree more.

  • I've never been able to figure out how to set access modifiers on type definitions. I can set the Attributes all day like this:

    type.Attributes = (type.Attributes &~ MemberAttributes.AccessMask) | MemberAttributes.Assembly;

    But it always makes the type public. Ditto for trying to make a class abstract. I'm was certain I must be doing something wrong, since such a glaring bug would have been obvious, but maybe CodeDom is really half-baked.


    Bonus bug: on an array initializer for a type that's an array-of-arrays, if the size is zero, it writes out C# as new int[0] rather than new int[0][].

Comments have been disabled for this content.