Description
On .NET 8 Preview 7.
Repro:
usingSystem.Diagnostics.CodeAnalysis;usingSystem.Reflection;IUnknownobj=newImpl();if(obj.QueryInterface<IBar>(outvarbar))bar.Bar();if(obj.QueryInterface<IFoo>(outvarfoo))foo.Foo();interfaceIComInterface{abstractstaticGuidIID{get;}}interfaceIUnknown:IComInterface{staticGuidIComInterface.IID=>new("00000000-0000-0000-C000-000000000046");staticGuidGetIID<TVtbl>()whereTVtbl:IComInterface=>TVtbl.IID;[UnconditionalSuppressMessage("ILLink","IL2111")][UnconditionalSuppressMessage("ILLink","IL2075")]boolQueryInterface<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces|DynamicallyAccessedMemberTypes.NonPublicProperties)]T>([NotNullWhen(true)]outT?result)whereT:IComInterface{foreach(varpinGetType().GetInterfaces().SelectMany(([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicProperties)]i)=>i.GetProperty("IComInterface.IID",BindingFlags.NonPublic|BindingFlags.Static)isPropertyInfopropertyInfo?[propertyInfo]:Array.Empty<PropertyInfo>())){if(p.GetValue(this)isGuidguid&&guid==GetIID<T>()){result=(T)this;returntrue;}}result=default;returnfalse;}}interfaceIFoo:IComInterface,IUnknown{staticGuidIComInterface.IID=>new("12345678-1234-1234-1234-1234567890AB");voidFoo();}interfaceIBar:IComInterface,IUnknown{staticGuidIComInterface.IID=>new("12345678-1234-1234-1234-1234567890CD");voidBar();}interfaceIBaz:IComInterface,IFoo,IBar{staticGuidIComInterface.IID=>new("12345678-1234-1234-1234-1234567890EF");}partialstructImpl:IBaz{publicvoidFoo()=>Console.WriteLine("foo");publicvoidBar()=>Console.WriteLine("bar");}Reproduction Steps
Build the source with NativeAOT and run it.
Expected behavior
No crashing.
Actual behavior
Crashing.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
On .NET 8 Preview 7.
Repro:
Reproduction Steps
Build the source with NativeAOT and run it.
Expected behavior
No crashing.
Actual behavior
Crashing.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response