In attempting to migrate some .NET Framework 4.8 code to .NET 6, I'm finding that the IDisposable interface is not marked [ComVisible(true)]. This is surprising since it was ComVisible in the earlier .NET Framework.
- Why was this change made?
- Any suggestions on how to deal with this change for code that depends on that interface being available in COM?
I'm not sure what to try at this point.
Current version of .NET has COM visibility by default enabled for public types, thus you don't have to decorate those types with
[ComVisible(true)]. It may have been different in earlier versions of .NET and COM visibility could have been disabled by default, thus you had to decorate types with[ComVisible(true)]to make them visible. That would be my guess why that has changed. I can't find any related information about this topic anywhere online.You don't have to deal with this change in any way as by default managed assembly is COM visible, thus you don't have to decorate public types with
[ComVisible(true)], but if you want to exclude public types you have to decorate them[ComVisible(false)]or mark whole assembly.