public override XElement GetDiagnosticInfo(SICDiagnosticArgument arguments)
        {
            XElement diagnosticInfo = base.GetDiagnosticInfo(arguments);

            diagnosticInfo.Add(this.DiagnosableObject.GetDiagnosticInfo(null));
            return(diagnosticInfo);
        }
예제 #2
0
        public virtual XElement GetDiagnosticInfo(SICDiagnosticArgument arguments)
        {
            XElement xelement = new XElement("ServiceIssue");

            xelement.Add(new object[]
            {
                new XElement("Guid", this.Guid),
                new XElement("Error", this.Error),
                new XElement("Type", base.GetType().FullName),
                new XElement("IdentifierString", this.IdentifierString),
                new XElement("CreatedTime", this.CreatedTime),
                new XElement("LastUpdatedTime", this.LastUpdatedTime)
            });
            return(xelement);
        }
예제 #3
0
        XElement IDiagnosable.GetDiagnosticInfo(DiagnosableParameters parameters)
        {
            XElement xelement = new XElement(this.ComponentName);
            SICDiagnosticArgument arguments = this.CreateDiagnosticArgumentParser();

            try
            {
                arguments.Initialize(parameters);
            }
            catch (DiagnosticArgumentException ex)
            {
                xelement.Add(new XElement("Error", "Encountered exception: " + ex.Message));
                xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments()));
                return(xelement);
            }
            List <ServiceIssue> list = null;

            if (arguments.HasArgument("invokescan"))
            {
                this.InvokeScan();
            }
            lock (this.cacheLock)
            {
                xelement.Add(new object[]
                {
                    new XElement("ScanFrequency", this.FullScanFrequency.ToString()),
                    new XElement("IssueLimit", this.IssueLimit),
                    new XElement("IsScanning", this.isScanning),
                    new XElement("IsEnabled", this.ScanningIsEnabled),
                    new XElement("LastScanStartTime", this.lastScanStartTime),
                    new XElement("LastScanDuration", this.lastScanDuration.TotalMilliseconds),
                    new XElement("NumberOfIssues", this.issueCache.Count)
                });
                if (this.LastScanError != null)
                {
                    xelement.Add(new object[]
                    {
                        new XElement("LastScanErrorName", this.LastScanError.GetType().Name),
                        new XElement("LastScanErrorMessage", this.LastScanError.Message)
                    });
                }
                if (arguments.HasArgument("issue"))
                {
                    list = new List <ServiceIssue>(this.issueCache.Values);
                }
            }
            if (list != null)
            {
                int      argumentOrDefault = arguments.GetArgumentOrDefault <int>("maxsize", list.Count);
                XElement xelement2         = new XElement("ServiceIssues");
                using (IEnumerator <ServiceIssue> enumerator = list.Take(argumentOrDefault).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ServiceIssue issue = enumerator.Current;
                        xelement2.Add(arguments.RunDiagnosticOperation(() => issue.GetDiagnosticInfo(arguments)));
                    }
                }
                xelement.Add(xelement2);
            }
            if (arguments.ArgumentCount == 0)
            {
                xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments()));
            }
            return(xelement);
        }