In compiler tests, remove the ResolveEventHandlers after test exit

0.8.0.3
Justin Clark-Casey (justincc) 2014-05-27 18:47:25 +01:00
parent 394ec508f6
commit 5622cf68aa
1 changed files with 6 additions and 3 deletions

View File

@ -49,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
private CSharpCodeProvider m_CSCodeProvider; private CSharpCodeProvider m_CSCodeProvider;
private CompilerParameters m_compilerParameters; private CompilerParameters m_compilerParameters;
private CompilerResults m_compilerResults; private CompilerResults m_compilerResults;
private ResolveEventHandler m_resolveEventHandler;
/// <summary> /// <summary>
/// Creates a temporary directory where build artifacts are stored. /// Creates a temporary directory where build artifacts are stored.
@ -70,9 +71,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
string rootPath = System.AppDomain.CurrentDomain.BaseDirectory; string rootPath = System.AppDomain.CurrentDomain.BaseDirectory;
System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve);
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve); System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler;
m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
@ -87,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
[TestFixtureTearDown] [TestFixtureTearDown]
public void CleanUp() public void CleanUp()
{ {
System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler;
if (Directory.Exists(m_testDir)) if (Directory.Exists(m_testDir))
{ {
// Blow away the temporary directory with artifacts. // Blow away the temporary directory with artifacts.