Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@ -23,7 +23,9 @@ namespace System {
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Diagnostics;
#if !MONO
using System.Security.Permissions;
#endif
using System.Security;
using System.IO;
using System.Text;
@ -31,16 +33,21 @@ namespace System {
using System.Collections;
using System.Globalization;
using System.Diagnostics.Contracts;
#if NETCORE
using __HResults = System.HResults;
#endif
#if !MONO
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_Exception))]
#endif
[Serializable]
[ComVisible(true)]
#if MONO
[StructLayout (LayoutKind.Sequential)]
#endif
public class Exception : ISerializable
#if !(MONO && MOBILE)
public partial class Exception : ISerializable
#if !MOBILE && !NETCORE
, _Exception
#endif
{
@ -162,12 +169,15 @@ namespace System {
public virtual IDictionary Data {
[System.Security.SecuritySafeCritical] // auto-generated
get {
if (_data == null)
if (_data == null) {
#if !MONO
if (IsImmutableAgileException(this))
_data = new EmptyReadOnlyDictionaryInternal();
else
#endif
_data = new ListDictionaryInternal();
}
return _data;
}
}
@ -210,7 +220,9 @@ namespace System {
}
}
#if !MONO
[FriendAccessAllowed]
#endif
internal void AddExceptionDataForRestrictedErrorInfo(
string restrictedError,
string restrictedErrorReference,
@ -390,8 +402,10 @@ namespace System {
String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo);
return remoteStackTraceString + tempStackTraceString;
}
#if !MONO
[FriendAccessAllowed]
#endif
internal void SetErrorCode(int hr)
{
HResult = hr;
@ -643,7 +657,7 @@ namespace System {
// this assert to ensure that it fails when that exception's _safeSerializationManager is NULL
Contract.Assert(((_safeSerializationManager != null) || (this.GetType().Assembly == typeof(object).Assembly)),
"User defined exceptions must have a valid _safeSerializationManager");
// Handle serializing any transparent or partial trust subclass data
_safeSerializationManager.CompleteSerialization(this, info, context);
}
@ -748,7 +762,14 @@ namespace System {
_stackTrace = null;
_stackTraceString = null;
}
#if MONO
// This is only needed for Watson support
private string StripFileInfo(string stackTrace, bool isRemoteStackTrace) {
return stackTrace;
}
#endif
#if FEATURE_EXCEPTIONDISPATCHINFO
// This is the object against which a lock will be taken
@ -785,12 +806,7 @@ namespace System {
}
}
#if MONO
// This is only needed for Watson support
private string StripFileInfo(string stackTrace, bool isRemoteStackTrace) {
return stackTrace;
}
#else
#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@ -949,7 +965,10 @@ namespace System {
{
return _HResult;
}
protected set
#if !NETCORE
protected
#endif
set
{
_HResult = value;
}
@ -978,6 +997,8 @@ namespace System {
// Mono addition: Used on iPhone
IntPtr[] native_trace_ips;
int caught_in_unmanaged;
#endif
// See clr\src\vm\excep.h's EXCEPTION_COMPLUS definition:
@ -1107,8 +1128,8 @@ namespace System {
internal Exception FixRemotingException ()
{
string message = (0 == _remoteStackIndex) ?
Locale.GetText ("{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}") :
Locale.GetText ("{1}{0}{0}Exception rethrown at [{2}]: {0}");
"{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}" :
"{1}{0}{0}Exception rethrown at [{2}]: {0}";
string tmp = String.Format (message, Environment.NewLine, StackTrace, _remoteStackIndex);
_remoteStackTraceString = tmp;