From 95253b3efcbff13d5fead1a8a7a0867aac57000f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:22:24 +0000 Subject: [PATCH 1/2] Initial plan From aadbb891d2612300f0df4bef88f4bc2764bca36d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:48:25 +0000 Subject: [PATCH 2/2] Update TypeMapLazyDictionary to use direct cast instead of 'as' for RuntimeAssembly Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com> --- .../System/Runtime/InteropServices/TypeMapLazyDictionary.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/TypeMapLazyDictionary.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/TypeMapLazyDictionary.cs index a644947b73463e..e18c1ffdda8ab6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/TypeMapLazyDictionary.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/TypeMapLazyDictionary.cs @@ -192,11 +192,11 @@ private static unsafe CallbackContext CreateMaps( RuntimeAssembly? startingAssembly; if (AppContext.GetData("System.Runtime.InteropServices.TypeMappingEntryAssembly") is string entryAssemblyName) { - startingAssembly = Assembly.Load(entryAssemblyName) as RuntimeAssembly; + startingAssembly = (RuntimeAssembly?)Assembly.Load(entryAssemblyName); } else { - startingAssembly = Assembly.GetEntryAssembly() as RuntimeAssembly; + startingAssembly = (RuntimeAssembly?)Assembly.GetEntryAssembly(); } if (startingAssembly is null)