Not that I generally tend to complain about features I don’t use, but I really wonder who suggested the following feature.
Classes (in code view) in the editor (at least for VB.NET) now have an active properties window, i.e. there actually are properties listed for classes. Actually, there are possible attributes listed for classes. To be 100% correct and complete, there are only 3 attributes listed: COM Class, COM Visible and Serializable.
You can set either of these attributes to False or True, which will result in a code change. So if you have this code
Public Class Test End Class
And you change the COM Visible property to False, this is what you get
<SYSTEM.RUNTIME.INTEROPSERVICES.COMVISIBLE(FALSE)> Public Class Test End Class
Here’s why I have a gripe with this feature
- It requires you to use the mouse to enter code in a code editor window. Bad idea if you ask me.
- It doesn’t care which Imports have already been declared, it always uses the fully qualified class name for the attribute. So even if you already have typed Imports System.Runtime.InteropServicesthe generator will still insert the entire string as indicated above. Too much clutter for no good reason.
- It’s not customizable. For example, I want a line break after each Attribute, but it doesn’t look like it’s possible to configure that.
- And perhaps above all, COM Visible is False by default (I have experienced this oddity after converting an assembly designed for COM Interop to .NET 2.0), yet in the Properties window, it is set to True if the attribute is not used to decorate the class, indicating that that’s the default value.
- Why only these three attributes? Because they are the most used ones? Bad reasoning, because everyone knows the most used attributes and can type them easily. The ones that would require use of a code generator are the more complicated ones. If you ask me, the attributes for Code Access Security would have been better candidates for inclusion in that list. And anyway, are the COM attributes really used that frequently?