示例#1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Suppression" /> class.
        /// </summary>
        public Suppression( )
        {
            var state = CallContext.LogicalGetData(CallContextKey) as SuppressionState;

            if (state == null)
            {
                state = new SuppressionState( );
                CallContext.LogicalSetData(CallContextKey, state);
            }

            state.Increment( );
        }
示例#2
0
        private void Init(string guid, SuppressionKind kind, SuppressionState state, string justification, Location location, IDictionary <string, SerializedPropertyInfo> properties)
        {
            Guid          = guid;
            Kind          = kind;
            State         = state;
            Justification = justification;
            if (location != null)
            {
                Location = new Location(location);
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
示例#3
0
 /// <summary>
 /// Converts the suppression state to boolean flag.
 /// </summary>
 /// <param name="suppressionState">The plain suppression state text.</param>
 /// <returns><see langword="true"/> if diagnostic is active, otherwise <see langword="false"/>.</returns>
 private static bool SuppressionStateToIsActive(SuppressionState suppressionState)
 {
     return(suppressionState != SuppressionState.Suppressed);
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Suppression" /> class from the supplied values.
 /// </summary>
 /// <param name="guid">
 /// An initialization value for the <see cref="P:Guid" /> property.
 /// </param>
 /// <param name="kind">
 /// An initialization value for the <see cref="P:Kind" /> property.
 /// </param>
 /// <param name="state">
 /// An initialization value for the <see cref="P:State" /> property.
 /// </param>
 /// <param name="justification">
 /// An initialization value for the <see cref="P:Justification" /> property.
 /// </param>
 /// <param name="location">
 /// An initialization value for the <see cref="P:Location" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P:Properties" /> property.
 /// </param>
 public Suppression(string guid, SuppressionKind kind, SuppressionState state, string justification, Location location, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(guid, kind, state, justification, location, properties);
 }