From 3bcbcb4f048585be149865630ccae44b93b897c5 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Thu, 9 Jun 2011 08:38:16 -0700 Subject: [PATCH] #17920: Fix multi-threading issue Work Item: 17920 --HG-- branch : 1.x --- .../Orchard/HostContext/CommandHostContextProvider.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Tools/Orchard/HostContext/CommandHostContextProvider.cs b/src/Tools/Orchard/HostContext/CommandHostContextProvider.cs index 082bc3c84..12505b9db 100644 --- a/src/Tools/Orchard/HostContext/CommandHostContextProvider.cs +++ b/src/Tools/Orchard/HostContext/CommandHostContextProvider.cs @@ -113,7 +113,12 @@ namespace Orchard.HostContext { } private static CommandHost CreateWorkerAppDomainWithHost(string virtualPath, string physicalPath, Type hostType) { - ClientBuildManager clientBuildManager = new ClientBuildManager(virtualPath, physicalPath); + var clientBuildManager = new ClientBuildManager(virtualPath, physicalPath); + // Fix for http://orchard.codeplex.com/workitem/17920 + // By forcing the CBM to build App_Code, etc, we ensure that the ASP.NET BuildManager + // is in a state where it can safely (i.e. in a multi-threaded safe way) process + // multiple concurrent calls to "GetCompiledAssembly". + clientBuildManager.CompileApplicationDependencies(); return (CommandHost)clientBuildManager.CreateObject(hostType, false); } }