diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 196b813e9085..82822068030a 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -2457,34 +2457,52 @@ public void Exit () { [Test] [Category("NotOnWindows")] - [Ignore("https://github.com/mono/mono/issues/11385")] public void Crash () { + bool deleteCrash = true; + string [] crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + if (crashFileEntries.Length != 0) + deleteCrash = false; bool success = false; - - try { - vm.Detach (); - Start (new string [] { dtest_app_path, "crash-vm" }); - Event e = run_until ("crash"); - while (!success) { - vm.Resume (); - e = GetNextEvent (); - var crash = e as CrashEvent; - if (crash == null) - continue; - - success = true; - Assert.AreNotEqual (0, crash.Dump.Length); - - break; - } - } finally { + for (int i = 0 ; i < 10; i++) { try { vm.Detach (); + Start (new string [] { dtest_app_path, "crash-vm" }); + Event e = run_until ("crash"); + while (!success) { + vm.Resume (); + e = GetNextEvent (); + var crash = e as CrashEvent; + if (crash == null) + continue; + + success = true; + Assert.AreNotEqual (0, crash.Dump.Length); + + break; + } + } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. + success = false; } finally { - vm = null; + try { + vm.Detach (); + } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. + success = false; + } finally { + vm = null; + } } + if (success) + break; + //try again because of unreliability of the crash reporter. + TearDown(); + SetUp(); + } + if (deleteCrash) { + crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + foreach (string f in crashFileEntries) { + File.Delete(f); + } } - if (!success) Assert.Fail ("Didn't get crash event"); }