-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Runtime.InteropServicespartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updated
Milestone
Description
Description
In the CsWinRT 3.0 CI, we have been occasionally seeing TypeMapping.GetOrCreateExternalTypeMapping throw ArgumentException. This seems to happen for different types and reruns typically cause it to pass. I have also been able to repro it locally a couple times but took multiple runs of the same exe.
It does seem to happen only on CoreCLR and we haven't been able to repro it with AOT. Inspecting the assemblies doesn't show any duplicate attributes for the TypeMap. The specific typemap entry from the exception stack in this instance is in WinRT.Interop.dll.
Reproduction Steps
Run ClassActivation.exe until repro
Expected behavior
No exception when there is no duplicate typemap entry
Actual behavior
Exception type: System.ArgumentException
Message: An item with the same key has already been added. Key: Windows.Foundation.IAsyncOperation`1<System.Collections.Generic.IReadOnlyList`1<Windows.ApplicationModel.Contacts.ContactAnnotationList>>
InnerException: <none>
StackTrace (generated):
SP IP Function
027BE478 0509B6D4 System_Private_CoreLib!System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[[System.__Canon, System.Private.CoreLib]](System.__Canon)+0x1c
027BE488 6E88BAD4 System_Private_CoreLib!System.Runtime.InteropServices.TypeMapLazyDictionary+LazyExternalTypeDictionary.Add(System.String, TypeNameUtf8, System.Reflection.RuntimeAssembly)+0x84
027BE4A8 6E88B5C4 System_Private_CoreLib!System.Runtime.InteropServices.TypeMapLazyDictionary.NewExternalTypeEntry(CallbackContext*, ProcessAttributesCallbackArg*)+0x84
027BE628 0509BA93 System_Private_CoreLib!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()+0x2b
027BE634 6E88B845 System_Private_CoreLib!System.Runtime.InteropServices.TypeMapLazyDictionary.CreateMaps(System.RuntimeType, BOOL (CallbackContext*, ProcessAttributesCallbackArg*), BOOL (CallbackContext*, ProcessAttributesCallbackArg*))+0xf5
027BE6A4 6E88B879 System_Private_CoreLib!System.Runtime.InteropServices.TypeMapLazyDictionary.CreateExternalTypeMap(System.RuntimeType)+0x29
027BE6C4 6EBFE03D System_Private_CoreLib!System.Runtime.InteropServices.TypeMapping.GetOrCreateExternalTypeMapping[[System.__Canon, System.Private.CoreLib]]()+0x1d
027BE6D0 05097A3F WinRT_Runtime2!WindowsRuntime.InteropServices.WindowsRuntimeMarshallingInfo..cctor()+0x1f
Regression?
No response
Known Workarounds
No response
Configuration
.NET 10
x86/x64 CoreCLR
Other information
No response
Copilot
Metadata
Metadata
Assignees
Labels
area-System.Runtime.InteropServicespartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updated
Type
Projects
Status
No status