diff options
author | Alistair Bush <alistair.bush@gmail.com> | 2014-01-11 15:35:37 +0400 |
---|---|---|
committer | Alistair Bush <alistair.bush@gmail.com> | 2014-01-11 15:35:37 +0400 |
commit | 2d7b174c93211ee49622bd940da81fada26fa231 (patch) | |
tree | 273da32b9adcd3e01fc4d9b4fe308b032b984ba8 /mcs/class | |
parent | 4b0111dac91f63701175e4f6e09ebc9fd5aa4106 (diff) |
Don't raise an exception if we can't find the src assembly.
These changes are released under the MIT license.
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/corlib/Test/System/AppDomainTest.cs | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/mcs/class/corlib/Test/System/AppDomainTest.cs b/mcs/class/corlib/Test/System/AppDomainTest.cs index 9c950226391..8772d7afdea 100644 --- a/mcs/class/corlib/Test/System/AppDomainTest.cs +++ b/mcs/class/corlib/Test/System/AppDomainTest.cs @@ -3308,6 +3308,14 @@ namespace MonoTests.System TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int))); } + [Test] + public void ShadowCopyTypeGetTypeMissingAssemblyTest () + { + ad = CreateShadowCopyAppDomain (tempDir, true); + CrossDomainTester tester = CreateCrossDomainTester (ad); + tester.AssertLoadMissingAssemblyType (); + } + private static AppDomain CreateTestDomain (string baseDirectory, bool assemblyResolver) { AppDomainSetup setup = new AppDomainSetup (); @@ -3316,6 +3324,15 @@ namespace MonoTests.System return CreateTestDomain (setup, assemblyResolver); } + private static AppDomain CreateShadowCopyAppDomain (string baseDirectory, bool assemblyResolver) + { + AppDomainSetup setup = new AppDomainSetup (); + setup.ApplicationBase = baseDirectory; + setup.ApplicationName = "testdomain"; + setup.ShadowCopyFiles = "true"; + return CreateTestDomain (setup, assemblyResolver); + } + private static AppDomain CreateTestDomain (AppDomainSetup setup, bool assemblyResolver) { AppDomain ad = AppDomain.CreateDomain ("testdomain", @@ -3423,22 +3440,17 @@ namespace MonoTests.System } } - public bool AssertFileLoadException (AssemblyName assemblyRef) + public void AssertLoadMissingAssemblyType () { - try { - AppDomain.CurrentDomain.Load (assemblyRef); - return false; - } catch (FileLoadException) { - return true; - } + Assert.IsNull (Type.GetType ("A.B.C, MissingAssembly")); } - public bool AssertFileNotFoundException (AssemblyName assemblyRef) + public bool AssertFileLoadException (AssemblyName assemblyRef) { try { AppDomain.CurrentDomain.Load (assemblyRef); return false; - } catch (FileNotFoundException) { + } catch (FileLoadException) { return true; } } @@ -3608,4 +3620,4 @@ namespace MonoTests.System } } -#endif
\ No newline at end of file +#endif |