Of course, this is a mistake. This is a good company, many other classes from mscorlib have the same problem. For example, Registry, Directory, File, Buffer, Environment, Nullable, Monitor, Timeout. But not sequentially, the attribute was correctly omitted for BitConverter, Console, Convert, GC, Math, etc.
The attribute is otherwise important for many classes in mscorlib; CLR user hosts and scripting languages ββdepend on it. It seems that the Microsoft programmer who used this attribute just worked on autopilot. The mistake is immaterial, TLBEXP knows how to deal with it. The component receives the [noncreatable] attribute, so client programs cannot instantiate the class. And auto-generated interfaces are empty. Thus, the type is simply not applicable, and you cannot use it either.
If you really want to use System.IO.Path from the COM client program, you need to write a shell class [ComVisible] for it. Non-static, of course, every method you write can simply delegate directly to one of the Path methods. You want the [appobject] attribute to be selected in the class, so it behaves statically in a client program that supports the attribute, unfortunately .NET does not have an attribute for it.
source share