diff options
Diffstat (limited to 'src/mscorlib/src/System/Diagnostics')
30 files changed, 88 insertions, 1080 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Assert.cs b/src/mscorlib/src/System/Diagnostics/Assert.cs index 77cc6d8e46..9f4b86b7e4 100644 --- a/src/mscorlib/src/System/Diagnostics/Assert.cs +++ b/src/mscorlib/src/System/Diagnostics/Assert.cs @@ -4,7 +4,6 @@ namespace System.Diagnostics { using System; - using System.Security.Permissions; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; @@ -36,14 +35,6 @@ namespace System.Diagnostics { } } - internal static void Check(bool condition, String conditionString, String message, int exitCode) - { - if (!condition) - { - Fail(conditionString, message, null, exitCode); - } - } - internal static void Fail(String conditionString, String message) { Fail(conditionString, message, null, COR_E_FAILFAST); diff --git a/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs b/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs index b20931f9c3..c57fb59319 100644 --- a/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs +++ b/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs @@ -7,7 +7,6 @@ using System; namespace System.Diagnostics { [Serializable] [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple=true)] - [System.Runtime.InteropServices.ComVisible(true)] public sealed class ConditionalAttribute : Attribute { public ConditionalAttribute(String conditionString) diff --git a/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs b/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs index 27f4f4cdaa..93d6c48701 100644 --- a/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs +++ b/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs @@ -41,7 +41,6 @@ using System.Runtime.ConstrainedExecution; #endif #if FEATURE_UNTRUSTED_CALLERS using System.Security; -using System.Security.Permissions; #endif namespace System.Diagnostics.Contracts { @@ -294,7 +293,6 @@ namespace System.Diagnostics.Contracts { [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Assume(bool condition) { @@ -315,7 +313,6 @@ namespace System.Diagnostics.Contracts { [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Assume(bool condition, String userMessage) { @@ -336,7 +333,6 @@ namespace System.Diagnostics.Contracts { [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Assert(bool condition) { @@ -353,7 +349,6 @@ namespace System.Diagnostics.Contracts { [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Assert(bool condition, String userMessage) { @@ -377,7 +372,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Requires(bool condition) { @@ -397,7 +391,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Requires(bool condition, String userMessage) { @@ -417,7 +410,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Requires<TException>(bool condition) where TException : Exception { @@ -439,7 +431,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Requires<TException>(bool condition, String userMessage) where TException : Exception { @@ -462,7 +453,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Ensures(bool condition) { @@ -482,7 +472,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Ensures(bool condition, String userMessage) { @@ -503,7 +492,6 @@ namespace System.Diagnostics.Contracts { [Conditional("CONTRACTS_FULL")] [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Exception type used in tools.")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void EnsuresOnThrow<TException>(bool condition) where TException : Exception { @@ -525,7 +513,6 @@ namespace System.Diagnostics.Contracts { [Conditional("CONTRACTS_FULL")] [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Exception type used in tools.")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void EnsuresOnThrow<TException>(bool condition, String userMessage) where TException : Exception { @@ -545,7 +532,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Not intended to be called at runtime.")] [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static T Result<T>() { return default(T); } @@ -561,7 +547,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "0#", Justification = "Not intended to be called at runtime.")] [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static T ValueAtReturn<T>(out T value) { value = default(T); return value; } @@ -577,7 +562,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value")] [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static T OldValue<T>(T value) { return default(T); } @@ -599,7 +583,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Invariant(bool condition) { @@ -619,7 +602,6 @@ namespace System.Diagnostics.Contracts { [Pure] [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void Invariant(bool condition, String userMessage) { @@ -644,7 +626,6 @@ namespace System.Diagnostics.Contracts { /// <seealso cref="System.Collections.Generic.List<T>.TrueForAll"/> [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] // Assumes predicate obeys CER rules. #endif public static bool ForAll(int fromInclusive, int toExclusive, Predicate<int> predicate) { @@ -675,7 +656,6 @@ namespace System.Diagnostics.Contracts { /// <seealso cref="System.Collections.Generic.List<T>.TrueForAll"/> [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] // Assumes predicate & collection enumerator obey CER rules. #endif public static bool ForAll<T>(IEnumerable<T> collection, Predicate<T> predicate) { @@ -706,7 +686,6 @@ namespace System.Diagnostics.Contracts { /// <seealso cref="System.Collections.Generic.List<T>.Exists"/> [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] // Assumes predicate obeys CER rules. #endif public static bool Exists(int fromInclusive, int toExclusive, Predicate<int> predicate) { @@ -736,7 +715,6 @@ namespace System.Diagnostics.Contracts { /// <seealso cref="System.Collections.Generic.List<T>.Exists"/> [Pure] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] // Assumes predicate & collection enumerator obey CER rules. #endif public static bool Exists<T>(IEnumerable<T> collection, Predicate<T> predicate) { @@ -756,107 +734,6 @@ namespace System.Diagnostics.Contracts { #endregion Quantifiers #region Pointers -#if FEATURE_UNSAFE_CONTRACTS - /// <summary> - /// Runtime checking for pointer bounds is not currently feasible. Thus, at runtime, we just return - /// a very long extent for each pointer that is writable. As long as assertions are of the form - /// WritableBytes(ptr) >= ..., the runtime assertions will not fail. - /// The runtime value is 2^64 - 1 or 2^32 - 1. - /// </summary> - [SuppressMessage("Microsoft.Performance", "CA1802", Justification = "FxCop is confused")] - static readonly ulong MaxWritableExtent = (UIntPtr.Size == 4) ? UInt32.MaxValue : UInt64.MaxValue; - - /// <summary> - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes writable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong WritableBytes(UIntPtr startAddress) { return MaxWritableExtent - startAddress.ToUInt64(); } - - /// <summary> - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes writable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong WritableBytes(IntPtr startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// <summary> - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes writable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - - unsafe public static ulong WritableBytes(void* startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// <summary> - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes readable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong ReadableBytes(UIntPtr startAddress) { return MaxWritableExtent - startAddress.ToUInt64(); } - - /// <summary> - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes readable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong ReadableBytes(IntPtr startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// <summary> - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// </summary> - /// <param name="startAddress">Start of memory region</param> - /// <returns>The result is the number of bytes readable starting at <paramref name="startAddress"/></returns> - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - unsafe public static ulong ReadableBytes(void* startAddress) { return MaxWritableExtent - (ulong)startAddress; } -#endif // FEATURE_UNSAFE_CONTRACTS #endregion #region Misc. @@ -866,7 +743,6 @@ namespace System.Diagnostics.Contracts { /// </summary> [Conditional("CONTRACTS_FULL")] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void EndContractBlock() { } @@ -927,7 +803,6 @@ namespace System.Diagnostics.Contracts.Internal [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static string RaiseContractFailedEvent(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException) { @@ -939,7 +814,6 @@ namespace System.Diagnostics.Contracts.Internal /// </summary> [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void TriggerFailure(ContractFailureKind kind, String displayMessage, String userMessage, String conditionText, Exception innerException) { @@ -966,7 +840,6 @@ namespace System.Runtime.CompilerServices [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static string RaiseContractFailedEvent(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException) { @@ -981,7 +854,6 @@ namespace System.Runtime.CompilerServices /// </summary> [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void TriggerFailure(ContractFailureKind kind, String displayMessage, String userMessage, String conditionText, Exception innerException) { diff --git a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs index d5e3f29e6c..5f4de4f666 100644 --- a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs +++ b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs @@ -35,7 +35,6 @@ using System.Runtime.ConstrainedExecution; #endif #if FEATURE_UNTRUSTED_CALLERS using System.Security; -using System.Security.Permissions; #endif namespace System.Diagnostics.Contracts { @@ -93,7 +92,6 @@ namespace System.Diagnostics.Contracts { [SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Security.SecuritySafeCriticalAttribute")] [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif static partial void ReportFailure(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException) { @@ -120,15 +118,11 @@ namespace System.Diagnostics.Contracts { /// </summary> public static event EventHandler<ContractFailedEventArgs> ContractFailed { #if FEATURE_UNTRUSTED_CALLERS -#if FEATURE_LINK_DEMAND -#endif #endif add { System.Runtime.CompilerServices.ContractHelper.InternalContractFailed += value; } #if FEATURE_UNTRUSTED_CALLERS -#if FEATURE_LINK_DEMAND -#endif #endif remove { System.Runtime.CompilerServices.ContractHelper.InternalContractFailed -= value; @@ -149,7 +143,6 @@ namespace System.Diagnostics.Contracts { internal Exception thrownDuringHandler; #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public ContractFailedEventArgs(ContractFailureKind failureKind, String message, String condition, Exception originalException) { @@ -171,8 +164,6 @@ namespace System.Diagnostics.Contracts { } #if FEATURE_UNTRUSTED_CALLERS -#if FEATURE_LINK_DEMAND -#endif #endif public void SetHandled() { @@ -184,8 +175,6 @@ namespace System.Diagnostics.Contracts { } #if FEATURE_UNTRUSTED_CALLERS -#if FEATURE_LINK_DEMAND -#endif #endif public void SetUnwind() { @@ -233,10 +222,6 @@ namespace System.Diagnostics.Contracts { _Condition = info.GetString("Condition"); } -#if FEATURE_UNTRUSTED_CALLERS && FEATURE_SERIALIZATION -#if FEATURE_LINK_DEMAND && FEATURE_SERIALIZATION -#endif // FEATURE_LINK_DEMAND -#endif // FEATURE_UNTRUSTED_CALLERS public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { base.GetObjectData(info, context); @@ -434,7 +419,6 @@ namespace System.Runtime.CompilerServices } #if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif private static String GetDisplayMessage(ContractFailureKind failureKind, String userMessage, String conditionText) { diff --git a/src/mscorlib/src/System/Diagnostics/Debugger.cs b/src/mscorlib/src/System/Diagnostics/Debugger.cs index 8ebbc0a354..21c57dbfaf 100644 --- a/src/mscorlib/src/System/Diagnostics/Debugger.cs +++ b/src/mscorlib/src/System/Diagnostics/Debugger.cs @@ -13,11 +13,9 @@ namespace System.Diagnostics using System.Reflection; using System.Runtime.CompilerServices; using System.Security; - using System.Security.Permissions; using System.Runtime.Versioning; // No data, does not need to be marked with the serializable attribute - [System.Runtime.InteropServices.ComVisible(true)] public sealed class Debugger { // This should have been a static class, but wasn't as of v3.5. Clearly, this is @@ -34,42 +32,12 @@ namespace System.Diagnostics // debugger is launched. public static void Break() { - if (!Debugger.IsAttached) - { - // Try and demand UnmanagedCodePermission. This is done in a try block because if this - // fails we want to be able to silently eat the exception and just return so - // that the call to Break does not possibly cause an unhandled exception. - // The idea here is that partially trusted code shouldn't be able to launch a debugger - // without the user going through Watson. - try - { -#pragma warning disable 618 - new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); -#pragma warning restore 618 - } - - // If we enter this block, we do not have permission to break into the debugger - // and so we just return. - catch (SecurityException) - { - return; - } - } - // Causing a break is now allowed. BreakInternal(); } static void BreakCanThrow() { - if (!Debugger.IsAttached) - { -#pragma warning disable 618 - new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); -#pragma warning restore 618 - } - - // Causing a break is now allowed. BreakInternal(); } @@ -84,25 +52,6 @@ namespace System.Diagnostics if (Debugger.IsAttached) return (true); - // Try and demand UnmanagedCodePermission. This is done in a try block because if this - // fails we want to be able to silently eat the exception and just return so - // that the call to Break does not possibly cause an unhandled exception. - // The idea here is that partially trusted code shouldn't be able to launch a debugger - // without the user going through Watson. - try - { -#pragma warning disable 618 - new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); -#pragma warning restore 618 - } - - // If we enter this block, we do not have permission to break into the debugger - // and so we just return. - catch (SecurityException) - { - return (false); - } - // Causing the debugger to launch is now allowed. return (LaunchInternal()); } @@ -134,7 +83,6 @@ namespace System.Diagnostics // notification will apprise the debugger that it will need to slip a thread or abort the funceval // in such a situation. The notification is subject to collection after this function returns. // - [method:System.Runtime.InteropServices.ComVisible(false)] public static void NotifyOfCrossThreadDependency() { if (Debugger.IsAttached) diff --git a/src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs b/src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs index e75b653a0b..ce9987b9e2 100644 --- a/src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs +++ b/src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs @@ -19,23 +19,13 @@ namespace System.Diagnostics { [Serializable] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)] - [ComVisible(true)] public sealed class DebuggerStepThroughAttribute : Attribute { public DebuggerStepThroughAttribute () {} } [Serializable] -[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)] - [ComVisible(true)] - public sealed class DebuggerStepperBoundaryAttribute : Attribute - { - public DebuggerStepperBoundaryAttribute () {} - } - -[Serializable] [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor, Inherited = false)] - [ComVisible(true)] public sealed class DebuggerHiddenAttribute : Attribute { public DebuggerHiddenAttribute () {} @@ -43,7 +33,6 @@ namespace System.Diagnostics { [Serializable] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor |AttributeTargets.Struct, Inherited = false)] - [ComVisible(true)] public sealed class DebuggerNonUserCodeAttribute : Attribute { public DebuggerNonUserCodeAttribute () {} @@ -58,11 +47,9 @@ namespace System.Diagnostics { // won't preserve the debugging info, which will make debugging after // a JIT attach difficult. [AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Module, AllowMultiple = false)] - [ComVisible(true)] public sealed class DebuggableAttribute : Attribute { [Flags] - [ComVisible(true)] public enum DebuggingModes { None = 0x0, @@ -121,7 +108,6 @@ namespace System.Diagnostics { // Please also change the code which validates DebuggerBrowsableState variable (in this file) // if you change this enum. - [ComVisible(true)] public enum DebuggerBrowsableState { Never = 0, @@ -135,7 +121,6 @@ namespace System.Diagnostics { // the one currently supported with the csee.dat // (mcee.dat, autoexp.dat) file. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] - [ComVisible(true)] public sealed class DebuggerBrowsableAttribute: Attribute { private DebuggerBrowsableState state; @@ -156,7 +141,6 @@ namespace System.Diagnostics { // DebuggerTypeProxyAttribute [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] - [ComVisible(true)] public sealed class DebuggerTypeProxyAttribute: Attribute { private string typeName; @@ -215,7 +199,6 @@ namespace System.Diagnostics { // however: there is no access to aliases, locals, or pointers. // In addition, attributes on properties referenced in the expression are not processed. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Assembly, AllowMultiple = true)] - [ComVisible(true)] public sealed class DebuggerDisplayAttribute : Attribute { private string name; @@ -274,105 +257,6 @@ namespace System.Diagnostics { } } - - - /// <summary> - /// Signifies that the attributed type has a visualizer which is pointed - /// to by the parameter type name strings. - /// </summary> - [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] - [ComVisible(true)] - public sealed class DebuggerVisualizerAttribute: Attribute - { - private string visualizerObjectSourceName; - private string visualizerName; - private string description; - private string targetName; - private Type target; - - public DebuggerVisualizerAttribute(string visualizerTypeName) - { - this.visualizerName = visualizerTypeName; - } - public DebuggerVisualizerAttribute(string visualizerTypeName, string visualizerObjectSourceTypeName) - { - this.visualizerName = visualizerTypeName; - this.visualizerObjectSourceName = visualizerObjectSourceTypeName; - } - public DebuggerVisualizerAttribute(string visualizerTypeName, Type visualizerObjectSource) - { - if (visualizerObjectSource == null) { - throw new ArgumentNullException(nameof(visualizerObjectSource)); - } - Contract.EndContractBlock(); - this.visualizerName = visualizerTypeName; - this.visualizerObjectSourceName = visualizerObjectSource.AssemblyQualifiedName; - } - public DebuggerVisualizerAttribute(Type visualizer) - { - if (visualizer == null) { - throw new ArgumentNullException(nameof(visualizer)); - } - Contract.EndContractBlock(); - this.visualizerName = visualizer.AssemblyQualifiedName; - } - public DebuggerVisualizerAttribute(Type visualizer, Type visualizerObjectSource) - { - if (visualizer == null) { - throw new ArgumentNullException(nameof(visualizer)); - } - if (visualizerObjectSource == null) { - throw new ArgumentNullException(nameof(visualizerObjectSource)); - } - Contract.EndContractBlock(); - this.visualizerName = visualizer.AssemblyQualifiedName; - this.visualizerObjectSourceName = visualizerObjectSource.AssemblyQualifiedName; - } - public DebuggerVisualizerAttribute(Type visualizer, string visualizerObjectSourceTypeName) - { - if (visualizer == null) { - throw new ArgumentNullException(nameof(visualizer)); - } - Contract.EndContractBlock(); - this.visualizerName = visualizer.AssemblyQualifiedName; - this.visualizerObjectSourceName = visualizerObjectSourceTypeName; - } - - public string VisualizerObjectSourceTypeName - { - get { return visualizerObjectSourceName; } - } - public string VisualizerTypeName - { - get { return visualizerName; } - } - public string Description - { - get { return description; } - set { description = value; } - } - - public Type Target - { - set { - if( value == null) { - throw new ArgumentNullException(nameof(value)); - } - Contract.EndContractBlock(); - - targetName = value.AssemblyQualifiedName; - target = value; - } - - get { return target; } - } - - public string TargetTypeName - { - set { targetName = value; } - get { return targetName; } - } - } } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs index 11b6e6bac2..116b50f86c 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs @@ -22,7 +22,9 @@ namespace System.Diagnostics.Tracing #endif { [StructLayout(LayoutKind.Explicit, Size = 16)] +#if !CORECLR [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] +#endif // CORECLR internal struct EventDescriptor { # region private diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs index ce0fcb6acb..1da6a46707 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs @@ -8,7 +8,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using System.Security; +#if !CORECLR using System.Security.Permissions; +#endif // !CORECLR using System.Threading; using System; @@ -43,7 +45,9 @@ namespace System.Diagnostics.Tracing /// Only here because System.Diagnostics.EventProvider needs one more extensibility hook (when it gets a /// controller callback) /// </summary> +#if !CORECLR [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] +#endif // CORECLR internal partial class EventProvider : IDisposable { // This is the windows EVENT_DATA_DESCRIPTOR structure. We expose it because this is what @@ -341,9 +345,10 @@ namespace System.Diagnostics.Tracing { List<SessionInfo> liveSessionList = null; - GetSessionInfo((Action<int, long>) - ((etwSessionId, matchAllKeywords) => - GetSessionInfoCallback(etwSessionId, matchAllKeywords, ref liveSessionList))); + GetSessionInfo( + (int etwSessionId, long matchAllKeywords, ref List<SessionInfo> sessionList) => + GetSessionInfoCallback(etwSessionId, matchAllKeywords, ref sessionList), + ref liveSessionList); List<Tuple<SessionInfo, bool>> changedSessionList = new List<Tuple<SessionInfo, bool>>(); @@ -407,12 +412,14 @@ namespace System.Diagnostics.Tracing } } + private delegate void SessionInfoCallback(int etwSessionId, long matchAllKeywords, ref List<SessionInfo> sessionList); + /// <summary> /// This method enumerates over all active ETW sessions that have enabled 'this.m_Guid' /// for the current process ID, calling 'action' for each session, and passing it the /// ETW session and the 'AllKeywords' the session enabled for the current provider. /// </summary> - private unsafe void GetSessionInfo(Action<int, long> action) + private unsafe void GetSessionInfo(SessionInfoCallback action, ref List<SessionInfo> sessionList) { // We wish the EventSource package to be legal for Windows Store applications. // Currently EnumerateTraceGuidsEx is not an allowed API, so we avoid its use here @@ -453,7 +460,7 @@ namespace System.Diagnostics.Tracing var enabledInfos = (UnsafeNativeMethods.ManifestEtw.TRACE_ENABLE_INFO*)&providerInstance[1]; // iterate over the list of active ETW sessions "listening" to the current provider for (int j = 0; j < providerInstance->EnableCount; j++) - action(enabledInfos[j].LoggerId, enabledInfos[j].MatchAllKeyword); + action(enabledInfos[j].LoggerId, enabledInfos[j].MatchAllKeyword, ref sessionList); } if (providerInstance->NextOffset == 0) break; @@ -503,7 +510,7 @@ namespace System.Diagnostics.Tracing string keywordBitString = dataAsString.Substring(startIdx, endIdx-startIdx); int keywordBit; if (0 < endIdx && int.TryParse(keywordBitString, out keywordBit)) - action(etwSessionId, 1L << keywordBit); + action(etwSessionId, 1L << keywordBit, ref sessionList); } } } @@ -556,7 +563,9 @@ namespace System.Diagnostics.Tracing string valueName = "ControllerData_Session_" + etwSessionId.ToString(CultureInfo.InvariantCulture); // we need to assert this permission for partial trust scenarios +#if !CORECLR (new RegistryPermission(RegistryPermissionAccess.Read, regKey)).Assert(); +#endif data = Microsoft.Win32.Registry.GetValue(regKey, valueName, null) as byte[]; if (data != null) { diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs index aa0d8d72d1..a558a1647e 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs @@ -187,7 +187,9 @@ using System.Globalization; using System.Reflection; using System.Resources; using System.Security; +#if !CORECLR using System.Security.Permissions; +#endif // !CORECLR using System.Text; using System.Threading; @@ -3047,7 +3049,7 @@ namespace System.Diagnostics.Tracing } if (s_currentPid == 0) { -#if ES_BUILD_STANDALONE && !ES_BUILD_PCL +#if ES_BUILD_STANDALONE && !ES_BUILD_PCL && !CORECLR // for non-BCL EventSource we must assert SecurityPermission new SecurityPermission(PermissionState.Unrestricted).Assert(); #endif @@ -3803,7 +3805,9 @@ namespace System.Diagnostics.Tracing // RET // // If we find this pattern we return the XXX. Otherwise we return -1. +#if !CORECLR (new ReflectionPermission(ReflectionPermissionFlag.MemberAccess)).Assert(); +#endif byte[] instrs = method.GetMethodBody().GetILAsByteArray(); int retVal = -1; for (int idx = 0; idx < instrs.Length;) @@ -4221,7 +4225,7 @@ namespace System.Diagnostics.Tracing public EventListener() { // This will cause the OnEventSourceCreated callback to fire. - CallBackForExistingEventSources(true, (obj, args) => args.EventSource.AddListener(this)); + CallBackForExistingEventSources(true, (obj, args) => args.EventSource.AddListener((EventListener)obj)); } /// <summary> @@ -6741,6 +6745,7 @@ namespace System.Diagnostics.Tracing stringBuilder.Append(eventMessage, startIndex, count); } + private static readonly string[] s_escapes = { "&", "<", ">", "'", """, "%r", "%n", "%t" }; // Manifest messages use %N conventions for their message substitutions. Translate from // .NET conventions. We can't use RegEx for this (we are in mscorlib), so we do it 'by hand' private string TranslateToManifestConvention(string eventMessage, string evtName) @@ -6808,16 +6813,10 @@ namespace System.Diagnostics.Tracing } else if ((chIdx = "&<>'\"\r\n\t".IndexOf(eventMessage[i])) >= 0) { - string[] escapes = { "&", "<", ">", "'", """, "%r", "%n", "%t" }; - var update = new Action<char, string>( - (ch, escape) => - { - UpdateStringBuilder(ref stringBuilder, eventMessage, writtenSoFar, i - writtenSoFar); - i++; - stringBuilder.Append(escape); - writtenSoFar = i; - }); - update(eventMessage[i], escapes[chIdx]); + UpdateStringBuilder(ref stringBuilder, eventMessage, writtenSoFar, i - writtenSoFar); + i++; + stringBuilder.Append(s_escapes[chIdx]); + writtenSoFar = i; } else i++; diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs index 6d3e28fcab..80c524b350 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs @@ -86,7 +86,10 @@ namespace System.Diagnostics.Tracing { // WriteEvent overloads (to avoid the "params" EventSource.WriteEvent // optimized for common signatures (used by the ThreadTransferSend/Receive events) - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEvent(int eventId, long arg1, int arg2, string arg3, bool arg4) { @@ -110,7 +113,10 @@ namespace System.Diagnostics.Tracing { } // optimized for common signatures (used by the ThreadTransferSend/Receive events) - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEvent(int eventId, long arg1, int arg2, string arg3) { @@ -132,7 +138,10 @@ namespace System.Diagnostics.Tracing { } // optimized for common signatures (used by the BeginGetResponse/BeginGetRequestStream events) - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEvent(int eventId, long arg1, string arg2, bool arg3, bool arg4) { @@ -156,7 +165,10 @@ namespace System.Diagnostics.Tracing { } // optimized for common signatures (used by the EndGetRequestStream event) - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEvent(int eventId, long arg1, bool arg2, bool arg3) { @@ -174,7 +186,10 @@ namespace System.Diagnostics.Tracing { } // optimized for common signatures (used by the EndGetResponse event) - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEvent(int eventId, long arg1, bool arg2, bool arg3, int arg4) { @@ -479,7 +494,10 @@ namespace System.Diagnostics.Tracing { public void ThreadPoolEnqueueWork(long workID) { WriteEvent(30, workID); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void ThreadPoolEnqueueWorkObject(object workID) { // convert the Object Id to a long ThreadPoolEnqueueWork((long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref workID))); @@ -490,7 +508,10 @@ namespace System.Diagnostics.Tracing { WriteEvent(31, workID); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void ThreadPoolDequeueWorkObject(object workID) { // convert the Object Id to a long ThreadPoolDequeueWork((long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref workID))); @@ -524,25 +545,37 @@ namespace System.Diagnostics.Tracing { WriteEvent(143, id, success, synchronous); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void BeginGetResponse(object id, string uri, bool success, bool synchronous) { if (IsEnabled()) GetResponseStart(IdForObject(id), uri, success, synchronous); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void EndGetResponse(object id, bool success, bool synchronous, int statusCode) { if (IsEnabled()) GetResponseStop(IdForObject(id), success, synchronous, statusCode); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void BeginGetRequestStream(object id, string uri, bool success, bool synchronous) { if (IsEnabled()) GetRequestStreamStart(IdForObject(id), uri, success, synchronous); } - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void EndGetRequestStream(object id, bool success, bool synchronous) { if (IsEnabled()) GetRequestStreamStop(IdForObject(id), success, synchronous); @@ -563,7 +596,10 @@ namespace System.Diagnostics.Tracing { // id - is a managed object. it gets translated to the object's address. ETW listeners must // keep track of GC movements in order to correlate the value passed to XyzSend with the // (possibly changed) value passed to XyzReceive - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void ThreadTransferSendObj(object id, int kind, string info, bool multiDequeues) { ThreadTransferSend((long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref id)), kind, info, multiDequeues); } @@ -583,7 +619,10 @@ namespace System.Diagnostics.Tracing { // id - is a managed object. it gets translated to the object's address. ETW listeners must // keep track of GC movements in order to correlate the value passed to XyzSend with the // (possibly changed) value passed to XyzReceive - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void ThreadTransferReceiveObj(object id, int kind, string info) { ThreadTransferReceive((long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref id)), kind, info); } @@ -603,7 +642,10 @@ namespace System.Diagnostics.Tracing { // id - is a managed object. it gets translated to the object's address. ETW listeners must // keep track of GC movements in order to correlate the value passed to XyzSend with the // (possibly changed) value passed to XyzReceive - [NonEvent, System.Security.SecuritySafeCritical] + [NonEvent] +#if !CORECLR + [System.Security.SecuritySafeCritical] +#endif // !CORECLR public unsafe void ThreadTransferReceiveHandledObj(object id, int kind, string info) { ThreadTransferReceive((long) *((void**) JitHelpers.UnsafeCastToStackPointer(ref id)), kind, info); } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs index 0cc17e02f3..d68e106b0b 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs @@ -61,7 +61,7 @@ namespace System.Diagnostics.Tracing if (name == null) { - throw new ArgumentNullException("eventName"); + throw new ArgumentNullException(nameof(name)); } Contract.EndContractBlock(); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs b/src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs index c96d2129f0..00155d72a0 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs @@ -23,7 +23,6 @@ namespace System.Diagnostics.Tracing private static bool initializedPersistentListener = false; - [System.Security.SecuritySafeCritical] public static EventListener InitializePersistentListener() { try{ @@ -150,7 +149,6 @@ namespace System.Diagnostics.Tracing } } - [System.Security.SecuritySafeCritical] private void LogOnEventWritten(EventWrittenEventArgs eventData) { string payload = ""; diff --git a/src/mscorlib/src/System/Diagnostics/LogSwitch.cs b/src/mscorlib/src/System/Diagnostics/LogSwitch.cs index 84f6b91f65..14f0f26d98 100644 --- a/src/mscorlib/src/System/Diagnostics/LogSwitch.cs +++ b/src/mscorlib/src/System/Diagnostics/LogSwitch.cs @@ -79,19 +79,6 @@ namespace System.Diagnostics { get { return strName;} } - // Get property returns the description of the switch - public virtual String Description - { - get {return strDescription;} - } - - - // Get property returns the parent of the switch - public virtual LogSwitch Parent - { - get { return ParentSwitch; } - } - // Property to Get/Set the level of log messages which are "on" for the switch. // diff --git a/src/mscorlib/src/System/Diagnostics/Stackframe.cs b/src/mscorlib/src/System/Diagnostics/Stackframe.cs index 06d675ea08..13d8f5cdcc 100644 --- a/src/mscorlib/src/System/Diagnostics/Stackframe.cs +++ b/src/mscorlib/src/System/Diagnostics/Stackframe.cs @@ -8,12 +8,10 @@ namespace System.Diagnostics { using System; using System.IO; using System.Reflection; - using System.Security.Permissions; using System.Diagnostics.Contracts; // There is no good reason for the methods of this class to be virtual. [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class StackFrame { private MethodBase method; @@ -23,10 +21,8 @@ namespace System.Diagnostics { private int iLineNumber; private int iColumnNumber; -#if FEATURE_EXCEPTIONDISPATCHINFO [System.Runtime.Serialization.OptionalField] private bool fIsLastFrameFromForeignExceptionStackTrace; -#endif // FEATURE_EXCEPTIONDISPATCHINFO internal void InitMembers() { @@ -36,9 +32,7 @@ namespace System.Diagnostics { strFileName = null; iLineNumber = 0; iColumnNumber = 0; -#if FEATURE_EXCEPTIONDISPATCHINFO fIsLastFrameFromForeignExceptionStackTrace = false; -#endif // FEATURE_EXCEPTIONDISPATCHINFO } @@ -142,7 +136,6 @@ namespace System.Diagnostics { iColumnNumber = iCol; } -#if FEATURE_EXCEPTIONDISPATCHINFO internal virtual void SetIsLastFrameFromForeignExceptionStackTrace (bool fIsLastFrame) { fIsLastFrameFromForeignExceptionStackTrace = fIsLastFrame; @@ -152,7 +145,6 @@ namespace System.Diagnostics { { return fIsLastFrameFromForeignExceptionStackTrace; } -#endif // FEATURE_EXCEPTIONDISPATCHINFO // Returns the method the frame is executing // @@ -187,17 +179,6 @@ namespace System.Diagnostics { // public virtual String GetFileName() { - if (strFileName != null) - { - // This isn't really correct, but we don't have - // a permission that protects discovery of potentially - // local urls so we'll use this. - - FileIOPermission perm = new FileIOPermission( PermissionState.None ); - perm.AllFiles = FileIOPermissionAccess.PathDiscovery; - perm.Demand(); - } - return strFileName; } @@ -262,24 +243,6 @@ namespace System.Diagnostics { bool useFileName = (strFileName != null); - if (useFileName) - { - try - { - // This isn't really correct, but we don't have - // a permission that protects discovery of potentially - // local urls so we'll use this. - - FileIOPermission perm = new FileIOPermission(PermissionState.None); - perm.AllFiles = FileIOPermissionAccess.PathDiscovery; - perm.Demand(); - } - catch (System.Security.SecurityException) - { - useFileName = false; - } - } - if (!useFileName) sb.Append("<filename unknown>"); else diff --git a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs index 7dc5d9df09..cd88f5108f 100644 --- a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs +++ b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs @@ -8,7 +8,6 @@ namespace System.Diagnostics { using System.Text; using System.Threading; using System.Security; - using System.Security.Permissions; using System.IO; using System.Reflection; using System.Runtime.InteropServices; @@ -49,10 +48,8 @@ namespace System.Diagnostics { private String[] rgFilename; private int[] rgiLineNumber; private int[] rgiColumnNumber; -#if FEATURE_EXCEPTIONDISPATCHINFO [OptionalField] private bool[] rgiLastFrameFromForeignExceptionStackTrace; -#endif // FEATURE_EXCEPTIONDISPATCHINFO private GetSourceLineInfoDelegate getSourceLineInfo; private int iFrameCount; #pragma warning restore 414 @@ -86,9 +83,7 @@ namespace System.Diagnostics { rgiColumnNumber = null; getSourceLineInfo = null; -#if FEATURE_EXCEPTIONDISPATCHINFO rgiLastFrameFromForeignExceptionStackTrace = null; -#endif // FEATURE_EXCEPTIONDISPATCHINFO // 0 means capture all frames. For StackTraces from an Exception, the EE always // captures all frames. For other uses of StackTraces, we can abort stack walking after @@ -198,15 +193,12 @@ namespace System.Diagnostics { public virtual int GetLineNumber(int i) { return rgiLineNumber == null ? 0 : rgiLineNumber[i];} public virtual int GetColumnNumber(int i) { return rgiColumnNumber == null ? 0 : rgiColumnNumber[i];} -#if FEATURE_EXCEPTIONDISPATCHINFO public virtual bool IsLastFrameFromForeignExceptionStackTrace(int i) { return (rgiLastFrameFromForeignExceptionStackTrace == null)?false:rgiLastFrameFromForeignExceptionStackTrace[i]; } -#endif // FEATURE_EXCEPTIONDISPATCHINFO public virtual int GetNumberOfFrames() { return iFrameCount;} - public virtual void SetNumberOfFrames(int i) { iFrameCount = i;} // // serialization implementation @@ -259,7 +251,6 @@ namespace System.Diagnostics { // StackTrace, we use an InheritanceDemand to prevent partially-trusted // subclasses. [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class StackTrace { private StackFrame[] frames; @@ -468,9 +459,7 @@ namespace System.Diagnostics { sfTemp.SetOffset(StackF.GetOffset(i)); sfTemp.SetILOffset(StackF.GetILOffset(i)); -#if FEATURE_EXCEPTIONDISPATCHINFO sfTemp.SetIsLastFrameFromForeignExceptionStackTrace(StackF.IsLastFrameFromForeignExceptionStackTrace(i)); -#endif // FEATURE_EXCEPTIONDISPATCHINFO if (fNeedFileInfo) { @@ -524,7 +513,6 @@ namespace System.Diagnostics { // The nth element of this array is the same as GetFrame(n). // The length of the array is the same as FrameCount. // - [ComVisible(false)] public virtual StackFrame [] GetFrames() { if (frames == null || m_iNumOfFrames <= 0) @@ -680,13 +668,11 @@ namespace System.Diagnostics { } } -#if FEATURE_EXCEPTIONDISPATCHINFO if (sf.GetIsLastFrameFromForeignExceptionStackTrace()) { sb.Append(Environment.NewLine); sb.Append(Environment.GetResourceString("Exception_EndStackTraceFromPreviousThrow")); } -#endif // FEATURE_EXCEPTIONDISPATCHINFO } } diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymBinder.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymBinder.cs deleted file mode 100644 index 1ce870f983..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymBinder.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - - -/*============================================================ -** -** -** -** Represents a symbol binder for managed code. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - - using System; - using System.Text; - using System.Runtime.InteropServices; - - // Interface does not need to be marked with the serializable attribute -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolBinder - { - // The importer parameter should be an IntPtr, not an int. This interface can not be modified without - // a breaking change, and so ISymbolBinderEx.GetReader() has been added with the correct marshalling layout. - [Obsolete("The recommended alternative is ISymbolBinder1.GetReader. ISymbolBinder1.GetReader takes the importer interface pointer as an IntPtr instead of an Int32, and thus works on both 32-bit and 64-bit architectures. http://go.microsoft.com/fwlink/?linkid=14202=14202")] - ISymbolReader GetReader(int importer, String filename, - String searchPath); - } - - // This interface has a revised ISymbolBinder.GetReader() with the proper signature. - // It is not called ISymbolBinder2 because it maps to the IUnmanagedSymbolBinder interfaces, and - // does not wrap the IUnmanagedSymbolBinder2 interfaces declared in CorSym.idl. -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolBinder1 - { - - ISymbolReader GetReader(IntPtr importer, String filename, - String searchPath); - } - -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocument.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocument.cs deleted file mode 100644 index c458b8e8a9..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocument.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a document referenced by a symbol store. A document is -** defined by a URL and a document type GUID. Using the document type -** GUID and the URL, one can locate the document however it is -** stored. Document source can optionally be stored in the symbol -** store. This interface also provides access to that source if it is -** present. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - - using System; - - // Interface does not need to be marked with the serializable attribute -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolDocument - { - // Properties of the document. - String URL { get; } - Guid DocumentType { get; } - - // Language of the document. - Guid Language { get; } - Guid LanguageVendor { get; } - - // Check sum information. - Guid CheckSumAlgorithmId { get; } - byte[] GetCheckSum(); - - // Given a line in this document that may or may not be a sequence - // point, return the closest line that is a sequence point. - int FindClosestLine(int line); - - // Access to embedded source. - bool HasEmbeddedSource { get; } - int SourceLength { get; } - byte[] GetSourceRange(int startLine, int startColumn, - int endLine, int endColumn); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocumentWriter.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocumentWriter.cs index 2b7b078dbc..a1a2366c0a 100644 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocumentWriter.cs +++ b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocumentWriter.cs @@ -17,7 +17,6 @@ namespace System.Diagnostics.SymbolStore { using System; // Interface does not need to be marked with the serializable attribute - [System.Runtime.InteropServices.ComVisible(true)] public interface ISymbolDocumentWriter { // SetSource will store the raw source for a document into the diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymMethod.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymMethod.cs deleted file mode 100644 index 5edabb1194..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymMethod.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a method within a symbol reader. This provides access to -** only the symbol-related attributes of a method, such as sequence -** points, lexical scopes, and parameter information. Use it in -** conjucntion with other means to read the type-related attrbiutes of -** a method, such as Reflections. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - using System.Runtime.InteropServices; - using System; - - // Interface does not need to be marked with the serializable attribute -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolMethod - { - // Get the token for this method. - SymbolToken Token { get; } - - // Get the count of sequence points. - int SequencePointCount { get; } - - // Get the sequence points for this method. The sequence points - // are sorted by offset and are for all documents in the - // method. Use GetSequencePointCount to retrieve the count of all - // sequence points and create arrays of the proper size. - // GetSequencePoints will verify the size of each array and place - // the sequence point information into each. If any array is NULL, - // then the data for that array is simply not returned. - void GetSequencePoints(int[] offsets, - ISymbolDocument[] documents, - int[] lines, - int[] columns, - int[] endLines, - int[] endColumns); - - // Get the root lexical scope for this method. This scope encloses - // the entire method. - ISymbolScope RootScope { get; } - - // Given an offset within the method, returns the most enclosing - // lexical scope. This can be used to start local variable - // searches. - ISymbolScope GetScope(int offset); - - // Given a position in a document, return the offset within the - // method that corresponds to the position. - int GetOffset(ISymbolDocument document, - int line, - int column); - - // Given a position in a document, return an array of start/end - // offset paris that correspond to the ranges of IL that the - // position covers within this method. The array is an array of - // integers and is [start,end,start,end]. The number of range - // pairs is the length of the array / 2. - int[] GetRanges(ISymbolDocument document, - int line, - int column); - - // Get the parameters for this method. The paraemeters are - // returned in the order they are defined within the method's - // signature. - ISymbolVariable[] GetParameters(); - - // Get the namespace that this method is defined within. - ISymbolNamespace GetNamespace(); - - // Get the start/end document positions for the source of this - // method. The first array position is the start while the second - // is the end. Returns true if positions were defined, false - // otherwise. - bool GetSourceStartEnd(ISymbolDocument[] docs, - int[] lines, - int[] columns); - } - -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymNamespace.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymNamespace.cs deleted file mode 100644 index 1dee13ef69..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymNamespace.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a namespace within a symbol reader. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - - using System; - - // Interface does not need to be marked with the serializable attribute -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolNamespace - { - // Get the name of this namespace - String Name { get; } - - // Get the children of this namespace - ISymbolNamespace[] GetNamespaces(); - - // Get the variables in this namespace - ISymbolVariable[] GetVariables(); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymReader.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymReader.cs deleted file mode 100644 index 8bc75e5aba..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymReader.cs +++ /dev/null @@ -1,68 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a symbol reader for managed code. Provides access to -** documents, methods, and variables. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Interface does not need to be marked with the serializable attribute - using System; - using System.Runtime.InteropServices; - - -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolReader - { - // Find a document. Language, vendor, and document type are - // optional. - ISymbolDocument GetDocument(String url, - Guid language, - Guid languageVendor, - Guid documentType); - - // Return an array of all of the documents defined in the symbol - // store. - ISymbolDocument[] GetDocuments(); - - // Return the method that was specified as the user entry point - // for the module, if any. This would be, perhaps, the user's main - // method rather than compiler generated stubs before main. - SymbolToken UserEntryPoint { get; } - - // Get a symbol reader method given the id of a method. - ISymbolMethod GetMethod(SymbolToken method); - - // Get a symbol reader method given the id of a method and an E&C - // version number. Version numbers start a 1 and are incremented - // each time the method is changed due to an E&C operation. - ISymbolMethod GetMethod(SymbolToken method, int version); - - // Return a non-local variable given its parent and name. - ISymbolVariable[] GetVariables(SymbolToken parent); - - // Return a non-local variable given its parent and name. - ISymbolVariable[] GetGlobalVariables(); - - // Given a position in a document, return the ISymbolMethod that - // contains that position. - ISymbolMethod GetMethodFromDocumentPosition(ISymbolDocument document, - int line, - int column); - - // Gets a custom attribute based upon its name. Not to be - // confused with Metadata custom attributes, these attributes are - // held in the symbol store. - byte[] GetSymAttribute(SymbolToken parent, String name); - - // Get the namespaces defined at global scope within this symbol store. - ISymbolNamespace[] GetNamespaces(); - } - -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymScope.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymScope.cs deleted file mode 100644 index 859d7d42c8..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymScope.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a lexical scope within a ISymbolMethod. Provides access to -** the start and end offsets of the scope, as well as its child and -** parent scopes. Also provides access to all the locals defined -** within this scope. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Interface does not need to be marked with the serializable attribute - using System; - using System.Text; - using System.Runtime.InteropServices; - -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolScope - { - // Get the method that contains this scope. - ISymbolMethod Method { get; } - - // Get the parent scope of this scope. - ISymbolScope Parent { get; } - - // Get any child scopes of this scope. - ISymbolScope[] GetChildren(); - - // Get the start and end offsets for this scope. - int StartOffset { get; } - int EndOffset { get; } - - // Get the locals within this scope. They are returned in no - // particular order. Note: if a local variable changes its address - // within this scope then that variable will be returned multiple - // times, each with a different offset range. - ISymbolVariable[] GetLocals(); - - // Get the namespaces that are being "used" within this scope. - ISymbolNamespace[] GetNamespaces(); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymVariable.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymVariable.cs deleted file mode 100644 index 857d24b2b6..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymVariable.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -** Represents a variable within a symbol store. This could be a -** parameter, local variable, or some other non-local variable. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Interface does not need to be marked with the serializable attribute - using System; - -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolVariable - { - // Get the name of this variable. - String Name { get; } - - // Get the attributes of this variable. - Object Attributes { get; } - - // Get the signature of this variable. - byte[] GetSignature(); - - SymAddressKind AddressKind { get; } - int AddressField1 { get; } - int AddressField2 { get; } - int AddressField3 { get; } - - // Get the start/end offsets of this variable within its - // parent. If this is a local variable within a scope, these will - // fall within the offsets defined for the scope. - int StartOffset { get; } - int EndOffset { get; } - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs index a0d3640c2c..bfe9133aee 100644 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs +++ b/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs @@ -20,13 +20,8 @@ namespace System.Diagnostics.SymbolStore { using System.Runtime.Versioning; // Interface does not need to be marked with the serializable attribute -[System.Runtime.InteropServices.ComVisible(true)] - public interface ISymbolWriter + internal interface ISymbolWriter { - // Set the IMetadataEmitter that this symbol writer is associated - // with. This must be done only once before any other ISymbolWriter - // methods are called. - void Initialize(IntPtr emitter, String filename, bool fFullBuild); // Define a source document. Guid's will be provided for the // languages, vendors, and document types that we currently know @@ -36,11 +31,6 @@ namespace System.Diagnostics.SymbolStore { Guid languageVendor, Guid documentType); - // Define the method that the user has defined as their entrypoint - // for this module. This would be, perhaps, the user's main method - // rather than compiler generated stubs before main. - void SetUserEntryPoint(SymbolToken entryMethod); - // Open a method to emit symbol information into. The given method // becomes the current method for calls do define sequence points, // parameters and lexical scopes. There is an implicit lexical @@ -88,9 +78,6 @@ namespace System.Diagnostics.SymbolStore { // last instruction in the scope. void CloseScope(int endOffset); - // Define the offset range for a given lexical scope. - void SetScopeRange(int scopeID, int startOffset, int endOffset); - // Define a single variable in the current lexical // scope. startOffset and endOffset are optional. If 0, then they // are ignored and the variable is defined over the entire @@ -109,80 +96,17 @@ namespace System.Diagnostics.SymbolStore { int startOffset, int endOffset); - // Define a single parameter in the current method. The type of - // each parameter is taken from its position (sequence) within the - // method's signature. - // - // Note: if parameters are defined in the metadata for a given - // method, then clearly one would not have to define them again - // with calls to this method. The symbol readers will have to be - // smart enough to check the normal metadata for these first then - // fall back to the symbol store. - void DefineParameter(String name, - ParameterAttributes attributes, - int sequence, - SymAddressKind addrKind, - int addr1, - int addr2, - int addr3); - - // Define a single variable not within a method. This is used for - // certian fields in classes, bitfields, etc. - void DefineField(SymbolToken parent, - String name, - FieldAttributes attributes, - byte[] signature, - SymAddressKind addrKind, - int addr1, - int addr2, - int addr3); - - // Define a single global variable. - void DefineGlobalVariable(String name, - FieldAttributes attributes, - byte[] signature, - SymAddressKind addrKind, - int addr1, - int addr2, - int addr3); - - // Close will close the ISymbolWriter and commit the symbols - // to the symbol store. The ISymbolWriter becomes invalid - // after this call for further updates. - void Close(); - // Defines a custom attribute based upon its name. Not to be // confused with Metadata custom attributes, these attributes are // held in the symbol store. void SetSymAttribute(SymbolToken parent, String name, byte[] data); - // Opens a new namespace. Call this before defining methods or - // variables that live within a namespace. Namespaces can be nested. - void OpenNamespace(String name); - - // Close the most recently opened namespace. - void CloseNamespace(); - // Specifies that the given, fully qualified namespace name is // being used within the currently open lexical scope. Closing the // current scope will also stop using the namespace, and the // namespace will be in use in all scopes that inherit from the // currently open scope. void UsingNamespace(String fullName); - - // Specifies the true start and end of a method within a source - // file. Use this to specify the extent of a method independently - // of what sequence points exist within the method. - void SetMethodSourceRange(ISymbolDocumentWriter startDoc, - int startLine, - int startColumn, - ISymbolDocumentWriter endDoc, - int endLine, - int endColumn); - - // Used to set the underlying ISymUnmanagedWriter that a - // managed ISymbolWriter may use to emit symbols with. - void SetUnderlyingWriter(IntPtr underlyingWriter); } } diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs index a7f866f2ec..bb50d9841b 100644 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs +++ b/src/mscorlib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs @@ -16,8 +16,7 @@ namespace System.Diagnostics.SymbolStore { using System; [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] - public enum SymAddressKind + internal enum SymAddressKind { // ILOffset: addr1 = IL local var or param index. ILOffset = 1, diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymDocumentType.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/SymDocumentType.cs deleted file mode 100644 index f7c7fea867..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymDocumentType.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -[System.Runtime.InteropServices.ComVisible(true)] -** A class to hold public guids for document types to be used with the -** symbol store. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Only statics does not need to be marked with the serializable attribute - using System; - -[System.Runtime.InteropServices.ComVisible(true)] - public class SymDocumentType - { - public static readonly Guid Text = new Guid(0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageType.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageType.cs deleted file mode 100644 index a67ba297af..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageType.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -[System.Runtime.InteropServices.ComVisible(true)] -** A class to hold public guids for languages types. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Only statics, does not need to be marked with the serializable attribute - using System; - -[System.Runtime.InteropServices.ComVisible(true)] - public class SymLanguageType - { - public static readonly Guid C = new Guid(0x63a08714, unchecked((short) 0xfc37), 0x11d2, 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); - public static readonly Guid CPlusPlus = new Guid(0x3a12d0b7, unchecked((short)0xc26c), 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); - - public static readonly Guid CSharp = new Guid(0x3f5162f8, unchecked((short)0x07c6), 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); - - public static readonly Guid Basic = new Guid(0x3a12d0b8, unchecked((short)0xc26c), 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); - - public static readonly Guid Java = new Guid(0x3a12d0b4, unchecked((short)0xc26c), 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); - - public static readonly Guid Cobol = new Guid(unchecked((int)0xaf046cd1), unchecked((short)0xd0e1), 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); - - public static readonly Guid Pascal = new Guid(unchecked((int)0xaf046cd2), unchecked((short) 0xd0e1), 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); - - public static readonly Guid ILAssembly = new Guid(unchecked((int)0xaf046cd3), unchecked((short)0xd0e1), 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); - - public static readonly Guid JScript = new Guid(0x3a12d0b6, unchecked((short)0xc26c), 0x11d0, 0xb4, 0x42, 0x00, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); - - public static readonly Guid SMC = new Guid(unchecked((int)0xd9b9f7b), 0x6611, unchecked((short)0x11d3), 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); - - public static readonly Guid MCPlusPlus = new Guid(0x4b35fde8, unchecked((short)0x07c6), 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageVendor.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageVendor.cs deleted file mode 100644 index 8bef10bdad..0000000000 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageVendor.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -/*============================================================ -** -** -** -[System.Runtime.InteropServices.ComVisible(true)] -** A class to hold public guids for language vendors. -** -** -===========================================================*/ -namespace System.Diagnostics.SymbolStore { - // Only statics, does not need to be marked with the serializable attribute - using System; - -[System.Runtime.InteropServices.ComVisible(true)] - public class SymLanguageVendor - { - public static readonly Guid Microsoft = new Guid(unchecked((int)0x994b45c4), unchecked((short) 0xe6e9), 0x11d2, 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); - } -} diff --git a/src/mscorlib/src/System/Diagnostics/SymbolStore/Token.cs b/src/mscorlib/src/System/Diagnostics/SymbolStore/Token.cs index a8a6675a2f..cc1e4a865f 100644 --- a/src/mscorlib/src/System/Diagnostics/SymbolStore/Token.cs +++ b/src/mscorlib/src/System/Diagnostics/SymbolStore/Token.cs @@ -14,8 +14,7 @@ namespace System.Diagnostics.SymbolStore { using System; using System.Runtime.InteropServices; - [ComVisible(true)] - public struct SymbolToken + internal struct SymbolToken { internal int m_token; @@ -37,15 +36,5 @@ namespace System.Diagnostics.SymbolStore { { return obj.m_token == m_token; } - - public static bool operator ==(SymbolToken a, SymbolToken b) - { - return a.Equals(b); - } - - public static bool operator !=(SymbolToken a, SymbolToken b) - { - return !(a == b); - } } } diff --git a/src/mscorlib/src/System/Diagnostics/log.cs b/src/mscorlib/src/System/Diagnostics/log.cs index 6916ce3a0a..d297b8fa08 100644 --- a/src/mscorlib/src/System/Diagnostics/log.cs +++ b/src/mscorlib/src/System/Diagnostics/log.cs @@ -5,7 +5,6 @@ namespace System.Diagnostics { using System.Runtime.Remoting; using System; - using System.Security.Permissions; using System.IO; using System.Collections; using System.Runtime.CompilerServices; @@ -13,18 +12,6 @@ namespace System.Diagnostics { using System.Runtime.Versioning; using System.Diagnostics.Contracts; using System.Diagnostics.CodeAnalysis; - - // LogMessageEventHandlers are triggered when a message is generated which is - // "on" per its switch. - // - // By default, the debugger (if attached) is the only event handler. - // There is also a "built-in" console device which can be enabled - // programatically, by registry (specifics....) or environment - // variables. - [Serializable] - internal delegate void LogMessageEventHandler(LoggingLevels level, LogSwitch category, - String message, - StackTrace location); // LogSwitchLevelHandlers are triggered when the level of a LogSwitch is modified @@ -49,7 +36,6 @@ namespace System.Diagnostics { // desired events are actually reported to the debugger. internal static Hashtable m_Hashtable; private static volatile bool m_fConsoleDeviceEnabled; - private static LogMessageEventHandler _LogMessageEventHandler; private static volatile LogSwitchLevelHandler _LogSwitchLevelHandler; private static Object locker; @@ -72,35 +58,6 @@ namespace System.Diagnostics { GlobalSwitch.MinimumLevel = LoggingLevels.ErrorLevel; } - public static void AddOnLogMessage(LogMessageEventHandler handler) - { - lock (locker) - _LogMessageEventHandler = - (LogMessageEventHandler) MulticastDelegate.Combine(_LogMessageEventHandler, handler); - } - - public static void RemoveOnLogMessage(LogMessageEventHandler handler) - { - - lock (locker) - _LogMessageEventHandler = - (LogMessageEventHandler) MulticastDelegate.Remove(_LogMessageEventHandler, handler); - } - - public static void AddOnLogSwitchLevel(LogSwitchLevelHandler handler) - { - lock (locker) - _LogSwitchLevelHandler = - (LogSwitchLevelHandler) MulticastDelegate.Combine(_LogSwitchLevelHandler, handler); - } - - public static void RemoveOnLogSwitchLevel(LogSwitchLevelHandler handler) - { - lock (locker) - _LogSwitchLevelHandler = - (LogSwitchLevelHandler) MulticastDelegate.Remove(_LogSwitchLevelHandler, handler); - } - internal static void InvokeLogSwitchLevelHandlers (LogSwitch ls, LoggingLevels newLevel) { LogSwitchLevelHandler handler = _LogSwitchLevelHandler; @@ -119,15 +76,6 @@ namespace System.Diagnostics { get { return m_fConsoleDeviceEnabled; } set { m_fConsoleDeviceEnabled = value; } } - - // Generates a log message. If its switch (or a parent switch) allows the - // level for the message, it is "broadcast" to all of the log - // devices. - // - public static void LogMessage(LoggingLevels level, String message) - { - LogMessage (level, GlobalSwitch, message); - } // Generates a log message. If its switch (or a parent switch) allows the // level for the message, it is "broadcast" to all of the log @@ -168,74 +116,10 @@ namespace System.Diagnostics { LogMessage (LoggingLevels.TraceLevel0, logswitch, message); } - public static void Trace(String switchname, String message) - { - LogSwitch ls; - ls = LogSwitch.GetSwitch (switchname); - LogMessage (LoggingLevels.TraceLevel0, ls, message); - } - public static void Trace(String message) { LogMessage (LoggingLevels.TraceLevel0, GlobalSwitch, message); } - - public static void Status(LogSwitch logswitch, String message) - { - LogMessage (LoggingLevels.StatusLevel0, logswitch, message); - } - - public static void Status(String switchname, String message) - { - LogSwitch ls; - ls = LogSwitch.GetSwitch (switchname); - LogMessage (LoggingLevels.StatusLevel0, ls, message); - } - - public static void Status(String message) - { - LogMessage (LoggingLevels.StatusLevel0, GlobalSwitch, message); - } - - public static void Warning(LogSwitch logswitch, String message) - { - LogMessage (LoggingLevels.WarningLevel, logswitch, message); - } - - public static void Warning(String switchname, String message) - { - LogSwitch ls; - ls = LogSwitch.GetSwitch (switchname); - LogMessage (LoggingLevels.WarningLevel, ls, message); - } - - public static void Warning(String message) - { - LogMessage (LoggingLevels.WarningLevel, GlobalSwitch, message); - } - - public static void Error(LogSwitch logswitch, String message) - { - LogMessage (LoggingLevels.ErrorLevel, logswitch, message); - } - - public static void Error(String switchname, String message) - { - LogSwitch ls; - ls = LogSwitch.GetSwitch (switchname); - LogMessage (LoggingLevels.ErrorLevel, ls, message); - - } - - public static void Error(String message) - { - LogMessage (LoggingLevels.ErrorLevel, GlobalSwitch, message); - } - - public static void Panic(String message) - { - LogMessage (LoggingLevels.PanicLevel, GlobalSwitch, message); - } // Native method to inform the EE about the creation of a new LogSwitch |