FaultPropagationRecord.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Tracking / FaultPropagationRecord.cs / 1305376 / FaultPropagationRecord.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Tracking 
{
    using System; 
    using System.Runtime.Serialization; 
    using System.Runtime;
    using System.Diagnostics; 
    using System.Globalization;

    [Fx.Tag.XamlVisible(false)]
    [DataContract] 
    public sealed class FaultPropagationRecord : TrackingRecord
    { 
 
        internal FaultPropagationRecord(Guid instanceId, ActivityInstance source, ActivityInstance faultHandler, bool isFaultSource, Exception fault)
            : base(instanceId) 
        {
            Fx.Assert(source != null, "Fault source cannot be null");
            this.FaultSource = new ActivityInfo(source);
 
            if (faultHandler != null)
            { 
                this.FaultHandler = new ActivityInfo(faultHandler); 
            }
            this.IsFaultSource = isFaultSource; 
            this.Fault = fault;
            this.Level = TraceLevel.Warning;
        }
 
        //parameter faultHandler is null if there are no handlers
        public FaultPropagationRecord( 
             Guid instanceId, 
             long recordNumber,
             ActivityInfo faultSource, 
             ActivityInfo faultHandler,
             bool isFaultSource,
             Exception fault)
            : base(instanceId, recordNumber) 
        {
            if (faultSource == null) 
            { 
                throw FxTrace.Exception.ArgumentNullOrEmpty("faultSource");
            } 

            this.FaultSource = faultSource;
            this.FaultHandler = faultHandler;
            this.IsFaultSource = isFaultSource; 
            this.Fault = fault;
            this.Level = TraceLevel.Warning; 
        } 

        FaultPropagationRecord(FaultPropagationRecord record) 
            :base(record)
        {
            this.FaultSource = record.FaultSource;
            this.FaultHandler = record.FaultHandler; 
            this.Fault = record.Fault;
            this.IsFaultSource = record.IsFaultSource; 
        } 

        [DataMember] 
        public ActivityInfo FaultSource
        {
            get;
            private set; 
        }
 
        [DataMember] 
        public ActivityInfo FaultHandler
        { 
            get;
            private set;
        }
 
        [DataMember(EmitDefaultValue = false)]
        public bool IsFaultSource 
        { 
            get;
            private set; 
        }

        [DataMember]
        public Exception Fault 
        {
            get; 
            private set; 
        }
 
        protected internal override TrackingRecord Clone()
        {
            return new FaultPropagationRecord(this);
        } 

        public override string ToString() 
        { 
            return string.Format(CultureInfo.CurrentCulture,
                "FaultPropagationRecord {{ {0}, FaultSource {{ {1} }}, FaultHandler {{ {2} }}, IsFaultSource = {3} }}", 
                base.ToString(),
                this.FaultSource.ToString(),
                this.FaultHandler != null ? this.FaultHandler.ToString() : "",
                this.IsFaultSource); 
        }
 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK