Skip to content

.NET 10: COM interop: IDispatchEx RCWs no longer support IReflect #121635

@ClearScriptLib

Description

@ClearScriptLib

Description

In .NET 10, RCWs for COM objects that implement IDispatchEx no longer support IReflect. This regression has broken hundreds of our tests.

Reproduction Steps

using System.Reflection;
var file = Activator.CreateInstance(Type.GetTypeFromProgID("htmlfile"));
Console.WriteLine("IReflect is " + (file is IReflect ? "supported" : "NOT supported"));

Expected behavior

D:\Code\IReflectTest>dotnet run -f net9.0-windows
IReflect is supported

Actual behavior

D:\Code\IReflectTest>dotnet run -f net10.0-windows
IReflect is NOT supported

Regression?

Yes, as shown above, this is a regression. .NET 9 and earlier (and .NET Framework) work as expected.

Known Workarounds

Communicating with the object via IDispatch or IDispatchEx is possible but painful 😒

Configuration

No response

Other information

No response

Metadata

Metadata

Labels

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions