Merge pull request #2799 from BrzVlad/fix-conc-card-clean
[mono.git] / mono / tests / unhandled-exception-7.cs
index 97835b97c97dc0945bb8c8f900ea5f0e8b88c9be..87c5fbb8cb17137e5df5aebcfccd7edfe88d11c9 100644 (file)
@@ -28,12 +28,20 @@ class CrossDomain : MarshalByRefObject
 
 class Driver
 {
-       /* expected exit code: 0 */
+       /* expected exit code: 255 */
        static void Main (string[] args)
        {
+               if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
+                       AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
+
                ManualResetEvent mre = new ManualResetEvent (false);
 
-               var cd = (CrossDomain) AppDomain.CreateDomain ("ad").CreateInstanceAndUnwrap (typeof(CrossDomain).Assembly.FullName, "CrossDomain");
+               var ad = AppDomain.CreateDomain ("ad");
+
+               if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
+                       ad.UnhandledException += (s, e) => {};
+
+               var cd = (CrossDomain) ad.CreateInstanceAndUnwrap (typeof(CrossDomain).Assembly.FullName, "CrossDomain");
 
                var action = cd.NewDelegateWithoutTarget ();
                var ares = action.BeginInvoke (Callback, null);