diff options
author | David Karlaš <david.karlas@xamarin.com> | 2017-05-08 18:17:26 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2017-05-08 22:33:17 +0300 |
commit | c09641892082fcee37278c29efe92db612061c90 (patch) | |
tree | d1524fdf6ce0cc2c810c1fb4ddb3629f42760f8f | |
parent | e5cdc000d76d1f94b23704ed8e60a3e1ae3169e2 (diff) |
bug51294 repro testbug51294repro
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Makefile | 5 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Mirror.cs | 2 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 23 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 46 |
4 files changed, 74 insertions, 2 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Makefile b/mcs/class/Mono.Debugger.Soft/Makefile index e2fa98dcebe..31861c3cee8 100644 --- a/mcs/class/Mono.Debugger.Soft/Makefile +++ b/mcs/class/Mono.Debugger.Soft/Makefile @@ -19,11 +19,14 @@ TEST_HELPERS_SOURCES = \ ../test-helpers/NetworkHelpers.cs \ Test/TypeLoadClass.cs -test-local: dtest-app.exe dtest-excfilter.exe +test-local: dtest-app.exe dtest-excfilter.exe appdomain-client.exe dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES) $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES) +appdomain-client.exe: ../../../mono/tests/appdomain-client.cs + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:appdomain-client.exe -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- ../../../mono/tests/appdomain-client.cs + dtest-excfilter.exe: Test/dtest-excfilter.il MONO_PATH=$(topdir)/class/lib/$(PROFILE) $(INTERNAL_ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Mirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Mirror.cs index 699706ceb24..a73962be370 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Mirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Mirror.cs @@ -21,7 +21,7 @@ namespace Mono.Debugger.Soft } } - internal long Id { + public long Id { get { return id; } diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index 400b43ce34f..a9c6b17d92d 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -292,6 +292,28 @@ public class Tests : TestsBase, ITest2 evt.WaitOne (); } + static void multi_domain_load() + { + var setup = new AppDomainSetup(); + setup.ApplicationBase = "."; + + AppDomain newDomain = AppDomain.CreateDomain("multi_domain_load_domain_1", null, setup); + + string[] args = { "1", "2", "3" }; + newDomain.ExecuteAssembly("appdomain-client.exe", null, args); + + + AppDomainSetup setup2 = new AppDomainSetup(); + setup2.ApplicationBase = "."; + + AppDomain newDomain2 = AppDomain.CreateDomain($"multi_domain_load_domain_2", null, setup2); + + newDomain2.ExecuteAssembly("appdomain-client.exe", null, args); + + AppDomain.Unload(newDomain); + AppDomain.Unload(newDomain2); + } + public static int Main (String[] args) { tls_i = 42; @@ -323,6 +345,7 @@ public class Tests : TestsBase, ITest2 return 0; } assembly_load (); + multi_domain_load(); breakpoints (); single_stepping (); arguments (); diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 631b5985db1..c14cb72d68d 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -2498,6 +2498,52 @@ public class DebuggerTests } [Test] + public void MultiDomainLoad () { + Event e = run_until ("multi_domain_load"); + + vm.EnableEvents (EventType.AppDomainCreate, EventType.AppDomainUnload, EventType.AssemblyUnload, EventType.AssemblyLoad); + + vm.Resume (); + var listOfAllAssembliesLoaded=new List<AssemblyMirror>(); + bool exitLoop = false; + while (!exitLoop) { + e = GetNextEvent (); + switch(e) + { + case AssemblyLoadEvent al: + Console.WriteLine($"({al.Assembly.Id})Assembly loaded {al.Assembly.Location} in {al.Assembly.Domain.FriendlyName} at thread:{e.Thread.Name}"); + listOfAllAssembliesLoaded.Add(((AssemblyLoadEvent)e).Assembly); + vm.Resume(); + break; + case AssemblyUnloadEvent au: + Console.WriteLine($"({au.Assembly.Id})Assembly unloaded {au.Assembly.Location} in {au.Assembly.Domain.FriendlyName} at thread:{e.Thread.Name}"); + vm.Resume(); + break; + case AppDomainCreateEvent dc: + Console.WriteLine($"Domain created {dc.Domain.FriendlyName} at thread:{e.Thread.Name}"); + vm.Resume(); + break; + case AppDomainUnloadEvent du: + Console.WriteLine($"Domain unloaded {du.Domain.FriendlyName} at thread:{e.Thread.Name}"); + vm.Resume(); + break; + case VMDeathEvent vmd: + exitLoop=true; + break; + default: + Console.WriteLine(e.GetType().FullName); + vm.Resume(); + break; + } + } + Assert.AreEqual( + 1/*Mono.Security.dll which loads before AppDomains are created*/+ + 2/*appdomain-client.exe which loads twice for 2 domains, see dtest-app.cs*/+ + 1/*System.Core.dll which loads at end*/ + ,listOfAllAssembliesLoaded.Count); + } + + [Test] public void AssemblyLoad () { Event e = run_until ("assembly_load"); |