Xamarin Public Jenkins (auto-signing) 413682e1ba Imported Upstream version 5.14.0.125
Former-commit-id: 436f655dff8d8f7c7b0eb3cb3c65e14ccf98b295
2018-06-07 18:52:37 +00:00

31 lines
996 B
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
namespace System.Runtime.Serialization
{
partial class DiagnosticUtility
{
internal static bool IsFatal(Exception exception)
{
while (exception != null)
{
// These exceptions aren't themselves fatal, but since the CLR uses them to wrap other exceptions,
// we want to check to see whether they've been used to wrap a fatal exception. If so, then they
// count as fatal.
if (exception is TypeInitializationException)
{
exception = exception.InnerException;
}
else
{
break;
}
}
return false;
}
}
}