Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@ -808,45 +808,15 @@ namespace System.Runtime.Remoting
[SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
internal static byte[] SerializeExceptionData (Exception ex)
{
byte[] result = null;
try {
int retry = 4;
do {
try {
MemoryStream ms = new MemoryStream ();
_serializationFormatter.Serialize (ms, ex);
return ms.ToArray ();
}
catch (Exception e) {
if (e is ThreadAbortException) {
#if MONO_FEATURE_THREAD_ABORT
Thread.ResetAbort ();
#endif
retry = 5;
ex = e;
}
else if (retry == 2) {
ex = new Exception ();
ex.SetMessage (e.Message);
ex.SetStackTrace (e.StackTrace);
}
else
ex = e;
}
retry--;
}
while (retry > 0);
return null;
}
catch (Exception tex)
{
byte[] data = SerializeExceptionData (tex);
#if MONO_FEATURE_THREAD_ABORT
Thread.ResetAbort ();
#endif
return data;
/* empty - we're only interested in the protected block */
} finally {
MemoryStream ms = new MemoryStream ();
_serializationFormatter.Serialize (ms, ex);
result = ms.ToArray ();
}
return result;
}
internal static object GetDomainProxy(AppDomain domain)