-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
Description
I get System.NotImplementedException in ComWrappers.TryGetOrCreateObjectForComInstanceInternal when COM Aggregation is used when using ComWrappers.GetOrRegisterObjectForComInstance like in case of WinRT class inheriting.
Reproduction Steps
- Clone https://github.com/ahmed605/NativeAOTComWrappersAggregationRepro
- Open a VS Developer Command Prompt
cdtoNativeAOTComWrappersAggregationRepro- Publish with NativeAOT:
msbuild NativeAOTComWrappersAggregationRepro.csproj -t:restore,publish /p:Configuration=Release /p:Platform=x64 /p:RuntimeIdentifier=win-x64 /p:TargetFramework=net8.0-windows10.0.22000.0- Run the published .exe
- Attach a debugger
- Press any key to continue execution
Expected behavior
The app prints "Hello!" to the console.
Actual behavior
Crash with System.NotImplementedException in ComWrappers.TryGetOrCreateObjectForComInstanceInternal
And this is printed into the console:
Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
at System.Runtime.InteropServices.ComWrappers.TryGetOrCreateObjectForComInstanceInternal(IntPtr, IntPtr, CreateObjectFlags, Object, Object&) + 0x554
at System.Runtime.InteropServices.ComWrappers.GetOrRegisterObjectForComInstance(IntPtr, CreateObjectFlags, Object, IntPtr) + 0x30
at WinRT.ComWrappersHelper.Init(Boolean, Object, IntPtr, IntPtr, IObjectReference&) + 0x151
at TestComponent.Class..ctor() + 0x72
at NativeAOTComWrappersAggregationRepro.Program.Main(String[] args) + 0x29
at NativeAOTComWrappersAggregationRepro!<BaseAddress>+0x2735c4
Stacktrace:
NativeAOTComWrappersAggregationRepro.exe!S_P_CoreLib_System_Runtime_InteropServices_ComWrappers__TryGetOrCreateObjectForComInstanceInternal() Line 726
NativeAOTComWrappersAggregationRepro.exe!S_P_CoreLib_System_Runtime_InteropServices_ComWrappers__GetOrRegisterObjectForComInstance_0() Line 648
NativeAOTComWrappersAggregationRepro.exe!WinRT_Runtime_WinRT_ComWrappersHelper__Init()
NativeAOTComWrappersAggregationRepro.exe!TestComponent_Projection_TestComponent_Class___ctor() Line 108
NativeAOTComWrappersAggregationRepro.exe!NativeAOTComWrappersAggregationRepro_NativeAOTComWrappersAggregationRepro_Program__Main() Line 15
NativeAOTComWrappersAggregationRepro.exe!NativeAOTComWrappersAggregationRepro__Module___StartupCodeMain()
NativeAOTComWrappersAggregationRepro.exe!wmain(int argc, wchar_t * * argv) Line 218
[Inline Frame] NativeAOTComWrappersAggregationRepro.exe!invoke_main() Line 90
NativeAOTComWrappersAggregationRepro.exe!__scrt_common_main_seh() Line 288
kernel32.dll!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
Regression?
No response
Known Workarounds
No response
Configuration
.NET 8.0.100 Preview 6 SDK
Other information
No response
dongle-the-gadget
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status
