Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Last active August 15, 2017 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/915177f818e57c02fb2b40dc691740dc to your computer and use it in GitHub Desktop.
Save rolfbjarne/915177f818e57c02fb2b40dc691740dc to your computer and use it in GitHub Desktop.
From b8cc025eed94936bb2f2d5b74bca5d350aa79e0a Mon Sep 17 00:00:00 2001
From: Rolf Bjarne Kvinge <rolf@xamarin.com>
Date: Tue, 15 Aug 2017 18:27:35 +0200
Subject: [PATCH] Fix
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture (ex).Throw ().
---
mono/mini/mini-exceptions.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index 7b307801ea3..05a9839a327 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -1519,6 +1519,11 @@ setup_stack_trace (MonoException *mono_ex, GSList *dynamic_methods, GList **trac
MonoError error;
MonoArray *ips_arr = mono_glist_to_array (*trace_ips, mono_defaults.int_class, &error);
mono_error_assert_ok (&error);
+ if (!ips_arr) {
+ // This makes System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture (ex).Throw () work
+ ips_arr = mono_array_new_checked (mono_domain_get (), mono_defaults.int_class, 0, &error);
+ mono_error_assert_ok (&error);
+ }
MONO_OBJECT_SETREF (mono_ex, trace_ips, ips_arr);
MONO_OBJECT_SETREF (mono_ex, native_trace_ips, build_native_trace (&error));
mono_error_assert_ok (&error);
--
2.13.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment