Merge pull request #3106 from lambdageek/dev/monoerror-unhandled
[mono.git] / mono / metadata / coree.c
index c2e47b9ca7b479a3a076a8db7c2f1694b2ac5212..4436229376e10101b1d16f827601c72f466d2328 100644 (file)
@@ -5,6 +5,7 @@
  *   Kornel Pal <http://www.kornelpal.hu/>
  *
  * Copyright (C) 2008 Kornel Pal
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include <config.h>
@@ -22,6 +23,7 @@
 #include "domain-internals.h"
 #include "appdomain.h"
 #include "object.h"
+#include "object-internals.h"
 #include "loader.h"
 #include "threads.h"
 #include "environment.h"
@@ -196,7 +198,8 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
                argv [i] = g_utf16_to_utf8 (argvw [i], -1, NULL, NULL, NULL);
        LocalFree (argvw);
 
-       mono_runtime_run_main (method, argc, argv, NULL);
+       mono_runtime_run_main_checked (method, argc, argv, &error);
+       mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
        mono_thread_manage ();
 
        mono_runtime_quit ();