[corlib] Fix cross-domain exception serialization under thread abortion.
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 11 Nov 2016 22:48:31 +0000 (14:48 -0800)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 11 Nov 2016 22:48:31 +0000 (14:48 -0800)
commit5a20ab05760534a3ac939ba6ec620a3a582f188a
tree7658b4af82a1084ac25e47e53fddd1e80882fd9d
parente29e5fd10478da5bdb61b2c6134c08bc99921049
[corlib] Fix cross-domain exception serialization under thread abortion.

RemotingServices::SerializeExceptionData started to fail as TAE was being raised
from within the serialization code and this triggered the completely wrong abort protection code.

This happened because a recent change that made .cctors raise TAE at their end and the stack trace
code would hit System.Reflection.Module's cctor to fetch its GUID for the purpose of symbolification.

The fix is to use the correct protection against aborts, which is to run code from finally blocks.

This fixes multiple failures in the runtime test suite.
mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs