From 8fdea5f6f5524692b014a170d8752a6a552935af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Aug 2026 05:23:11 +0000 Subject: [PATCH 1/6] Initial plan From f422559f379868ae85b4a71665d19ae656eeb8a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Aug 2026 05:47:21 +0000 Subject: [PATCH 2/6] Update BinderTracing resolving assertion Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../binding/tracing/BinderTracingTest.EventHandlers.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs index dec1ef23b3a60b..5fdacd58a66092 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs @@ -37,7 +37,8 @@ public static BindOperation AssemblyLoadContextResolving_ReturnNull() } catch { } - Assert.Single(handlers.Invocations); + List invocations = handlers.Invocations.Where(invocation => Helpers.AssemblyNamesMatch(invocation.AssemblyName, assemblyName)).ToList(); + Assert.Single(invocations); Assert.Empty(handlers.Binds); return new BindOperation() { @@ -47,7 +48,7 @@ public static BindOperation AssemblyLoadContextResolving_ReturnNull() RequestingAssemblyLoadContext = DefaultALC, Success = false, Cached = false, - AssemblyLoadContextResolvingHandlers = handlers.Invocations, + AssemblyLoadContextResolvingHandlers = invocations, NestedBinds = handlers.Binds }; } From 8b27b4ed1d1c41362b93719240467f4b2641285a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Aug 2026 17:25:24 +0000 Subject: [PATCH 3/6] Re-enable BinderTracing tests disabled by issue 68521 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../BinderTracingTest.EventHandlers.cs | 4 +--- .../BinderTracingTest.ResolutionFlow.cs | 19 ++++++------------- .../binding/tracing/BinderTracingTest.cs | 9 ++++++--- src/tests/Loader/binding/tracing/Helpers.cs | 13 +++++++++++++ 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs index 5fdacd58a66092..353418789070e1 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs @@ -276,9 +276,7 @@ public static BindOperation AssemblyLoadFromResolveHandler_LoadDependency() }; } - [BinderTest(isolate: true, - additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" }, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true, additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" })] public static BindOperation AssemblyLoadFromResolveHandler_MissingDependency() { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.ResolutionFlow.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.ResolutionFlow.cs index a9549b2a4e55ad..30c98957aa85eb 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.ResolutionFlow.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.ResolutionFlow.cs @@ -73,8 +73,7 @@ public static BindOperation FindInLoadContext_DefaultALC() // ResolutionAttempted : DefaultAssemblyLoadContextFallback (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AppDomainAssemblyResolveEvent (CustomALC) [AssemblyNotFound] - [BinderTest(isolate: true, testSetup: nameof(LoadSubdirectoryAssembly_InstanceALC), - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true, testSetup: nameof(LoadSubdirectoryAssembly_InstanceALC))] public static BindOperation FindInLoadContext_CustomALC_IncompatibleVersion() { var assemblyName = new AssemblyName($"{SubdirectoryAssemblyName}, Version=4.3.2.1"); @@ -181,9 +180,7 @@ public static BindOperation ApplicationAssemblies_IncompatibleVersion() // ResolutionAttempted : ApplicationAssemblies (DefaultALC) [MismatchedAssemblyName] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (DefaultALC) [AssemblyNotFound] // ResolutionAttempted : AppDomainAssemblyResolveEvent (DefaultALC) [AssemblyNotFound] - [BinderTest(isolate: true, - additionalLoadsToTrack: new string[] { DependentAssemblyName + "_Copy" }, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes AssemblyNotFound instead of MismatchedAssemblyName. + [BinderTest(isolate: true, additionalLoadsToTrack: new string[] { DependentAssemblyName + "_Copy" })] public static BindOperation ApplicationAssemblies_MismatchedAssemblyName() { var assemblyName = new AssemblyName($"{DependentAssemblyName}_Copy, Culture=neutral, PublicKeyToken=null"); @@ -339,8 +336,7 @@ public static BindOperation ResolveSatelliteAssembly() // ResolutionAttempted : ApplicationAssemblies (DefaultALC) [AssemblyNotFound] // ResolutionAttempted : DefaultAssemblyLoadContextFallback (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (CustomALC) [Success] - [BinderTest(isolate: true, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true)] public static BindOperation AssemblyLoadContextResolvingEvent_CustomALC() { var assemblyName = new AssemblyName(SubdirectoryAssemblyName); @@ -409,8 +405,7 @@ public static BindOperation AssemblyLoadContextResolvingEvent_DefaultALC() // ResolutionAttempted : ApplicationAssemblies (DefaultALC) [AssemblyNotFound] // ResolutionAttempted : DefaultAssemblyLoadContextFallback (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (CustomALC) [Exception] - [BinderTest(isolate: true, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true)] public static BindOperation AssemblyLoadContextResolvingEvent_CustomALC_Exception() { var assemblyName = new AssemblyName(SubdirectoryAssemblyName); @@ -476,8 +471,7 @@ public static BindOperation AssemblyLoadContextResolvingEvent_DefaultALC_Excepti // ResolutionAttempted : DefaultAssemblyLoadContextFallback (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AppDomainAssemblyResolveEvent (CustomALC) [Success] - [BinderTest(isolate: true, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true)] public static BindOperation AppDomainAssemblyResolveEvent_CustomALC() { var assemblyName = new AssemblyName(SubdirectoryAssemblyName); @@ -550,8 +544,7 @@ public static BindOperation AppDomainAssemblyResolveEvent_DefaultALC() // ResolutionAttempted : DefaultAssemblyLoadContextFallback (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AssemblyLoadContextResolvingEvent (CustomALC) [AssemblyNotFound] // ResolutionAttempted : AppDomainAssemblyResolveEvent (CustomALC) [Exception] - [BinderTest(isolate: true, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true)] public static BindOperation AppDomainAssemblyResolveEvent_Exception() { var assemblyName = new AssemblyName(SubdirectoryAssemblyName); diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.cs index d567eb0f019598..9653b729a689c6 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.cs @@ -204,10 +204,13 @@ private static void ValidateSingleBind(BinderEventListener listener, AssemblyNam { Console.WriteLine($"[{DateTime.Now:T}] Validating bind operation for {assemblyName}..."); BindOperation[] binds = listener.WaitAndGetEventsForAssembly(assemblyName); - Assert.True(binds.Length == 1, $"Bind event count for {assemblyName} - expected: 1, actual: {binds.Length}"); - BindOperation actual = binds[0]; + List matchingBinds = binds + .Where(bind => Helpers.ValidateBindOperationOrReturnFalse(expected, bind)) + .ToList(); - Helpers.ValidateBindOperation(expected, actual); + Assert.True( + matchingBinds.Count == 1, + $"Bind event match count for {assemblyName} - expected: 1, actual: {matchingBinds.Count}; total events: {binds.Length}"); } } } diff --git a/src/tests/Loader/binding/tracing/Helpers.cs b/src/tests/Loader/binding/tracing/Helpers.cs index 6545104cb87158..09c3e06e13c747 100644 --- a/src/tests/Loader/binding/tracing/Helpers.cs +++ b/src/tests/Loader/binding/tracing/Helpers.cs @@ -41,6 +41,19 @@ public static void ValidateBindOperation(BindOperation expected, BindOperation a Console.WriteLine("ValidateBindOperation Finished"); } + internal static bool ValidateBindOperationOrReturnFalse(BindOperation expected, BindOperation actual) + { + try + { + ValidateBindOperation(expected, actual); + return true; + } + catch (Xunit.Sdk.XunitException) + { + return false; + } + } + public static string GetAssemblyInAppPath(string assemblyName) { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); From 07aa2d97a3773503ec1bb8f128d5de008afc6507 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 22:04:23 +0000 Subject: [PATCH 4/6] Apply remaining changes Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../Loader/binding/tracing/BinderTracingTest.cs | 9 +++------ src/tests/Loader/binding/tracing/Helpers.cs | 13 ------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.cs index 9653b729a689c6..d567eb0f019598 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.cs @@ -204,13 +204,10 @@ private static void ValidateSingleBind(BinderEventListener listener, AssemblyNam { Console.WriteLine($"[{DateTime.Now:T}] Validating bind operation for {assemblyName}..."); BindOperation[] binds = listener.WaitAndGetEventsForAssembly(assemblyName); - List matchingBinds = binds - .Where(bind => Helpers.ValidateBindOperationOrReturnFalse(expected, bind)) - .ToList(); + Assert.True(binds.Length == 1, $"Bind event count for {assemblyName} - expected: 1, actual: {binds.Length}"); + BindOperation actual = binds[0]; - Assert.True( - matchingBinds.Count == 1, - $"Bind event match count for {assemblyName} - expected: 1, actual: {matchingBinds.Count}; total events: {binds.Length}"); + Helpers.ValidateBindOperation(expected, actual); } } } diff --git a/src/tests/Loader/binding/tracing/Helpers.cs b/src/tests/Loader/binding/tracing/Helpers.cs index 09c3e06e13c747..6545104cb87158 100644 --- a/src/tests/Loader/binding/tracing/Helpers.cs +++ b/src/tests/Loader/binding/tracing/Helpers.cs @@ -41,19 +41,6 @@ public static void ValidateBindOperation(BindOperation expected, BindOperation a Console.WriteLine("ValidateBindOperation Finished"); } - internal static bool ValidateBindOperationOrReturnFalse(BindOperation expected, BindOperation actual) - { - try - { - ValidateBindOperation(expected, actual); - return true; - } - catch (Xunit.Sdk.XunitException) - { - return false; - } - } - public static string GetAssemblyInAppPath(string assemblyName) { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); From 104e1d0afe1e719facaf40b053c7595ccdb5f3e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 22:18:41 +0000 Subject: [PATCH 5/6] Restore BinderTracing EventHandlers skip Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../Loader/binding/tracing/BinderTracingTest.EventHandlers.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs index 353418789070e1..5fdacd58a66092 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs @@ -276,7 +276,9 @@ public static BindOperation AssemblyLoadFromResolveHandler_LoadDependency() }; } - [BinderTest(isolate: true, additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" })] + [BinderTest(isolate: true, + additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" }, + activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. public static BindOperation AssemblyLoadFromResolveHandler_MissingDependency() { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); From 2f87eef810efb6e51b2e5542bf32de7f460ed232 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 13 Aug 2026 10:36:50 -0700 Subject: [PATCH 6/6] Revert AssemblyLoadContextResolving_ReturnNull changes --- .../binding/tracing/BinderTracingTest.EventHandlers.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs index 5fdacd58a66092..43de22d9639cbd 100644 --- a/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs +++ b/src/tests/Loader/binding/tracing/BinderTracingTest.EventHandlers.cs @@ -37,8 +37,7 @@ public static BindOperation AssemblyLoadContextResolving_ReturnNull() } catch { } - List invocations = handlers.Invocations.Where(invocation => Helpers.AssemblyNamesMatch(invocation.AssemblyName, assemblyName)).ToList(); - Assert.Single(invocations); + Assert.Single(handlers.Invocations); Assert.Empty(handlers.Binds); return new BindOperation() { @@ -48,7 +47,7 @@ public static BindOperation AssemblyLoadContextResolving_ReturnNull() RequestingAssemblyLoadContext = DefaultALC, Success = false, Cached = false, - AssemblyLoadContextResolvingHandlers = invocations, + AssemblyLoadContextResolvingHandlers = handlers.Invocations, NestedBinds = handlers.Binds }; } @@ -276,9 +275,7 @@ public static BindOperation AssemblyLoadFromResolveHandler_LoadDependency() }; } - [BinderTest(isolate: true, - additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" }, - activeIssue: "https://github.com/dotnet/runtime/issues/68521")] // Emit-based Invoke causes an extra load. + [BinderTest(isolate: true, additionalLoadsToTrack: new string[] { "AssemblyToLoadDependency" })] // Emit-based Invoke causes an extra load. public static BindOperation AssemblyLoadFromResolveHandler_MissingDependency() { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);