I am trying to implement an COM functionality with C# and Native AOT and getting the following exception in target process "Explorer" "Indirect call guard check detected invalid control transfer." after passing my .NET Wrapped object.
This is Factory method that produces the wrapped COM object
[UnmanagedCallersOnly]
public static unsafe int CreateInstance(IntPtr self, IntPtr outer, Guid* guid, IntPtr* instance)
{
*instance = IntPtr.Zero;
ComWrappers cw = new StrategyBasedComWrappers();
XamlTap xamlTap = new XamlTap();
*instance = cw.GetOrCreateComInterfaceForObject(xamlTap, CreateComInterfaceFlags.None);
return HResult.S_OK;
}
Can someone point out what I might be doing wrong here? Thanks!