diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c
index b28e16d6a52fe8..f89dd106071379 100644
--- a/src/mono/mono/mini/method-to-ir.c
+++ b/src/mono/mono/mini/method-to-ir.c
@@ -7088,6 +7088,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
inst_tailcall && is_supported_tailcall (cfg, ip, method, NULL, fsig,
FALSE/*virtual irrelevant*/, addr != NULL, &tailcall);
+ if (save_last_error)
+ mono_emit_jit_icall (cfg, mono_marshal_clear_last_error, NULL);
+
if (callee) {
if (method->wrapper_type != MONO_WRAPPER_DELEGATE_INVOKE)
/* Not tested */
@@ -7589,10 +7592,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
}
- if (save_last_error) {
- mono_emit_jit_icall (cfg, mono_marshal_clear_last_error, NULL);
- }
-
/* Tail prefix / tailcall optimization */
/* FIXME: Enabling TAILC breaks some inlining/stack trace/etc tests.
diff --git a/src/tests/issues.targets b/src/tests/issues.targets
index afeb0dd15c7427..e7e63e8c0441ff 100644
--- a/src/tests/issues.targets
+++ b/src/tests/issues.targets
@@ -1236,9 +1236,6 @@
https://github.com/dotnet/runtime/issues/48084
-
- https://github.com/dotnet/runtime/issues/51600
-
needs triage
@@ -2444,6 +2441,9 @@
https://github.com/dotnet/runtime/issues/41519
+
+ https://github.com/dotnet/runtime/issues/41519
+
https://github.com/dotnet/runtime/issues/41519
@@ -2756,6 +2756,9 @@
needs triage
+
+ needs triage
+
needs triage