[runtime] Fix detecting abort at end of abort protected block
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 17 Mar 2017 21:45:50 +0000 (23:45 +0200)
committerVlad Brezae <brezaevlad@gmail.com>
Thu, 23 Mar 2017 21:46:23 +0000 (23:46 +0200)
commit4d1c90a812469fcf288a3b042cc9e74cedd3ed24
treefc42d2e50844bb2a25e152c1c131a7a6697dbceb
parentdba2b07309c3bd91707280408140dbdbe17c9cb5
[runtime] Fix detecting abort at end of abort protected block

If we have a pending abort then we know we will have the thread_state set and the thread_interruption_requested bumped. We used to consume this request and set the MonoError with the exception. The problems with this is that not all callsites handle the passed MonoError and handling it means converting it back to a pending exception anyway. We just leave the interruption request untouched now.

If the cctor self aborts it means that we consumed the abort exception so we do need to call mono_thread_resume_interruption to reactivate it. We need to make sure that we still don't throw a TypeInitializationException if we had a self abort.
mono/metadata/object.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/mini/mini-exceptions.c
mono/mini/mini-trampolines.c
mono/tests/abort-cctor.cs