Fix exception leaking from filter in nativeAOT (#85366)
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 28 Apr 2023 21:12:27 +0000 (23:12 +0200)
committerGitHub <noreply@github.com>
Fri, 28 Apr 2023 21:12:27 +0000 (23:12 +0200)
commit80ff9ee35786ba486fa00ad9113fe339132b55bf
treed5d47076cc87e339772aae9127ec464fc6de1129
parent02b8071c7212f409384c153c62f85a00b05edfb1
Fix exception leaking from filter in nativeAOT (#85366)

* Fix exception leaking from filter in nativeAOT

There is a bug in handling exceptions that occur in exception filters in
nativeAOT. If such exception is not handled in the filter, it needs to
be swallowed and the filter should behave as if it returned `false`.
Instead of that, the current behavior is that debug build of the runtime
asserts and the release build fails fast without any message.

This change fixes it by catching the exception in the exception handling
code. It was also necessary to modify the stack frame iterator to let it
unwind past the filter funclet instead of failing fast.

* Reenable tests disabled due to the issue
src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp
src/coreclr/nativeaot/Runtime/StackFrameIterator.h
src/tests/issues.targets