From a50234016067e14c1110e1794ceea1ae9881ff7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 29 May 2024 23:10:14 +0200 Subject: [PATCH] Fix assembly resolution with DeploymentItem (#3034) --- .../Services/TestSourceHost.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs index 792aab749e..8c6f9b95d1 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs @@ -154,6 +154,12 @@ public void SetupHost() // which is trigged by AppContainerUtilities.AttachEventToResolveWinmd method. EqtTrace.SetupRemoteEqtTraceListeners(AppDomain); + // Force loading Microsoft.TestPlatform.CoreUtilities in the new app domain to ensure there is no assembly resolution issue. + // For unknown reasons, with MSTest 3.4+ we start to see infinite cycles of assembly resolution of this dll in the new app + // domain. In older versions, this was not the case, and the callback was allowing to fully lookup and load the dll before + // triggering the next resolution. + AppDomain.Load(typeof(EqtTrace).Assembly.GetName()); + // Add an assembly resolver in the child app-domain... Type assemblyResolverType = typeof(AssemblyResolver);