summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Exception.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Exception.cs')
-rw-r--r--src/mscorlib/src/System/Exception.cs98
1 files changed, 1 insertions, 97 deletions
diff --git a/src/mscorlib/src/System/Exception.cs b/src/mscorlib/src/System/Exception.cs
index a8ee328f1c..a166c1ab0a 100644
--- a/src/mscorlib/src/System/Exception.cs
+++ b/src/mscorlib/src/System/Exception.cs
@@ -18,7 +18,6 @@ namespace System {
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Diagnostics;
- using System.Security.Permissions;
using System.Security;
using System.IO;
using System.Text;
@@ -27,11 +26,8 @@ namespace System {
using System.Globalization;
using System.Diagnostics.Contracts;
- [ClassInterface(ClassInterfaceType.None)]
- [ComDefaultInterface(typeof(_Exception))]
[Serializable]
- [ComVisible(true)]
- public class Exception : ISerializable, _Exception
+ public class Exception : ISerializable
{
private void Init()
{
@@ -48,9 +44,6 @@ namespace System {
// Initialize the watson bucketing IP
_ipForWatsonBuckets = UIntPtr.Zero;
-#if FEATURE_SERIALIZATION
- _safeSerializationManager = new SafeSerializationManager();
-#endif // FEATURE_SERIALIZATION
}
public Exception() {
@@ -100,9 +93,6 @@ namespace System {
// get null.
_watsonBuckets = (Object)info.GetValueNoThrow("WatsonBuckets", typeof(byte[]));
-#if FEATURE_SERIALIZATION
- _safeSerializationManager = info.GetValueNoThrow("SafeSerializationManager", typeof(SafeSerializationManager)) as SafeSerializationManager;
-#endif // FEATURE_SERIALIZATION
if (_className == null || HResult==0)
throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
@@ -493,19 +483,11 @@ namespace System {
return result;
}
-#if FEATURE_SERIALIZATION
- protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
- {
- add { _safeSerializationManager.SerializeObjectState += value; }
- remove { _safeSerializationManager.SerializeObjectState -= value; }
- }
-#else
protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
{
add { throw new PlatformNotSupportedException();}
remove { throw new PlatformNotSupportedException();}
}
-#endif // FEATURE_SERIALIZATION
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
@@ -549,50 +531,6 @@ namespace System {
// Serialize the Watson bucket details as well
info.AddValue("WatsonBuckets", _watsonBuckets, typeof(byte[]));
-#if FEATURE_SERIALIZATION
- if (_safeSerializationManager != null && _safeSerializationManager.IsActive)
- {
- info.AddValue("SafeSerializationManager", _safeSerializationManager, typeof(SafeSerializationManager));
-
- // User classes derived from Exception must have a valid _safeSerializationManager.
- // Exceptions defined in mscorlib don't use this field might not have it initalized (since they are
- // often created in the VM with AllocateObject instead if the managed construtor)
- // If you are adding code to use a SafeSerializationManager from an mscorlib exception, update
- // this assert to ensure that it fails when that exception's _safeSerializationManager is NULL
- Debug.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);
- }
-#endif // FEATURE_SERIALIZATION
- }
-
- // This is used by remoting to preserve the server side stack trace
- // by appending it to the message ... before the exception is rethrown
- // at the client call site.
- internal Exception PrepForRemoting()
- {
- String tmp = null;
-
- if (_remoteStackIndex == 0)
- {
- tmp = Environment.NewLine+ "Server stack trace: " + Environment.NewLine
- + StackTrace
- + Environment.NewLine + Environment.NewLine
- + "Exception rethrown at ["+_remoteStackIndex+"]: " + Environment.NewLine;
- }
- else
- {
- tmp = StackTrace
- + Environment.NewLine + Environment.NewLine
- + "Exception rethrown at ["+_remoteStackIndex+"]: " + Environment.NewLine;
- }
-
- _remoteStackTraceString = tmp;
- _remoteStackIndex++;
-
- return this;
}
// This method will clear the _stackTrace of the exception object upon deserialization
@@ -610,16 +548,6 @@ namespace System {
// Hence, we set it to zero when deserialization takes place.
_ipForWatsonBuckets = UIntPtr.Zero;
-#if FEATURE_SERIALIZATION
- if (_safeSerializationManager == null)
- {
- _safeSerializationManager = new SafeSerializationManager();
- }
- else
- {
- _safeSerializationManager.CompleteDeserialization(this);
- }
-#endif // FEATURE_SERIALIZATION
}
// This is used by the runtime when re-throwing a managed exception. It will
@@ -642,11 +570,9 @@ namespace System {
}
else
#else // FEATURE_APPX
-#if FEATURE_CORESYSTEM
// Preinitialize _source on CoreSystem as well. The legacy behavior is not ideal and
// we keep it for back compat but we can afford to make the change on the Phone.
string source = Source;
-#endif // FEATURE_CORESYSTEM
#endif // FEATURE_APPX
{
// Call the StackTrace getter in classic for compat.
@@ -662,7 +588,6 @@ namespace System {
_stackTraceString = null;
}
-#if FEATURE_EXCEPTIONDISPATCHINFO
// This is the object against which a lock will be taken
// when attempt to restore the EDI. Since its static, its possible
@@ -786,7 +711,6 @@ namespace System {
}
}
}
-#endif // FEATURE_EXCEPTIONDISPATCHINFO
private String _className; //Needed for serialization.
private MethodBase _exceptionMethod; //Needed for serialization.
@@ -834,10 +758,6 @@ namespace System {
[OptionalField]
private UIntPtr _ipForWatsonBuckets; // Used to persist the IP for Watson Bucketing
-#if FEATURE_SERIALIZATION
- [OptionalField(VersionAdded = 4)]
- private SafeSerializationManager _safeSerializationManager;
-#endif // FEATURE_SERIALIZATION
// See src\inc\corexcep.h's EXCEPTION_COMPLUS definition:
private const int _COMPlusExceptionCode = unchecked((int)0xe0434352); // Win32 exception code for COM+ exceptions
@@ -846,19 +766,6 @@ namespace System {
// and create a corresponding CrossAppDomainMarshaledException
internal virtual String InternalToString()
{
- try
- {
-#pragma warning disable 618
- SecurityPermission sp= new SecurityPermission(SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy);
-#pragma warning restore 618
- sp.Assert();
- }
- catch
- {
- //under normal conditions there should be no exceptions
- //however if something wrong happens we still can call the usual ToString
- }
-
// Get the current stack trace string.
return ToString(true, true);
}
@@ -917,9 +824,6 @@ namespace System {
// The Message field is set to the ToString() output of the original exception.
//--------------------------------------------------------------------------
-#if FEATURE_SERIALIZATION
- [Serializable]
-#endif
internal sealed class CrossAppDomainMarshaledException : SystemException
{
public CrossAppDomainMarshaledException(String message, int errorCode)