Describe the bug
We are testing CsWinRT-preview with AOT support with our product and during runtime when registering to an event handler we get the following exception:
Exception thrown at 0x00007FFD7D37545C (KernelBase.dll) in MyProcess.exe: WinRT originate error - 0x80131515 : 'Cannot provide IReference`1 support for delegate type 'System.Collections.Specialized.NotifyCollectionChangedEventHandler'.'.
So far there are 2 cases which are not supported:
1. "System.Collections.Specialized.NotifyCollectionChangedEventHandler"
2. "System.ComponentModel.PropertyChangedEventHandler"
Internal: https://task.ms/52539411
To Reproduce
- Create types like
PropertyChanged or CollectionChanged events that derive from those 2 problematics types above.
Expected behavior
After compiling with AOT, the event handler should be able to be registered.
A workaround is to created our own ModuleInitializer extension with the missing mapped types for the Vtable:
private static ComWrappers.ComInterfaceEntry[] LookupVtableEntries(Type type)
{
var typeName = type.ToString();
if (typeName == "System.Collections.Specialized.NotifyCollectionChangedEventHandler")
{
return new ComWrappers.ComInterfaceEntry[]
{
new ComWrappers.ComInterfaceEntry
{
IID = global::ABI.System.Collections.Specialized.NotifyCollectionChangedEventHandler.IID,
Vtable = global::ABI.System.Collections.Specialized.NotifyCollectionChangedEventHandler.AbiToProjectionVftablePtr
},
};
}
else if (typeName == "System.ComponentModel.PropertyChangedEventHandler")
{
return new ComWrappers.ComInterfaceEntry[]
{
new ComWrappers.ComInterfaceEntry
{
IID = global::ABI.System.ComponentModel.PropertyChangedEventHandler.IID,
Vtable = global::ABI.System.ComponentModel.PropertyChangedEventHandler.AbiToProjectionVftablePtr
},
};
}
return default;
}
Version Info
- CsWinRT: 2.1.0-prerelease-ci.240710.
Describe the bug
We are testing CsWinRT-preview with AOT support with our product and during runtime when registering to an event handler we get the following exception:
So far there are 2 cases which are not supported:
Internal: https://task.ms/52539411
To Reproduce
PropertyChangedorCollectionChangedevents that derive from those 2 problematics types above.Expected behavior
After compiling with AOT, the event handler should be able to be registered.
A workaround is to created our own
ModuleInitializerextension with the missing mapped types for the Vtable:Version Info