update analyzers and resolve new issues (#286)
This commit is contained in:
Родитель
0591a84269
Коммит
6b80473158
|
@ -11,6 +11,8 @@
|
||||||
<Rule Id="CA1001" Action="Warning" />
|
<Rule Id="CA1001" Action="Warning" />
|
||||||
<Rule Id="CA1009" Action="Warning" />
|
<Rule Id="CA1009" Action="Warning" />
|
||||||
<Rule Id="CA1016" Action="Warning" />
|
<Rule Id="CA1016" Action="Warning" />
|
||||||
|
<!-- Suppressing Message "Modify 'method' to catch a more specific exception type, or rethrow the exception" because we already catch Exceptions we care about and either log/ignore others. -->
|
||||||
|
<Rule Id="CA1031" Action="None" />
|
||||||
<Rule Id="CA1033" Action="Warning" />
|
<Rule Id="CA1033" Action="Warning" />
|
||||||
<Rule Id="CA1049" Action="Warning" />
|
<Rule Id="CA1049" Action="Warning" />
|
||||||
<Rule Id="CA1060" Action="Warning" />
|
<Rule Id="CA1060" Action="Warning" />
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Microsoft.ApplicationInsights.DiagnosticSourceListener
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DiagnosticSourceTelemetryModule"/> class.
|
/// Initializes a new instance of the <see cref="DiagnosticSourceTelemetryModule"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="onEventWrittenHandler">Action to be executed each time an event is written to format and send via the configured <see cref="TelemetryClient"/></param>
|
/// <param name="onEventWrittenHandler">Action to be executed each time an event is written to format and send via the configured <see cref="TelemetryClient"/>.</param>
|
||||||
public DiagnosticSourceTelemetryModule(OnEventWrittenHandler onEventWrittenHandler)
|
public DiagnosticSourceTelemetryModule(OnEventWrittenHandler onEventWrittenHandler)
|
||||||
{
|
{
|
||||||
if (onEventWrittenHandler == null)
|
if (onEventWrittenHandler == null)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
namespace Microsoft.ApplicationInsights.EtwCollector
|
namespace Microsoft.ApplicationInsights.EtwCollector
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using Diagnostics.Tracing;
|
using Microsoft.Diagnostics.Tracing;
|
||||||
using Microsoft.Diagnostics.Tracing.Session;
|
using Microsoft.Diagnostics.Tracing.Session;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
||||||
|
|
|
@ -180,7 +180,7 @@ namespace Microsoft.ApplicationInsights.EtwCollector
|
||||||
{
|
{
|
||||||
ProviderGuid = TplActivities.TplEventSourceGuid,
|
ProviderGuid = TplActivities.TplEventSourceGuid,
|
||||||
Level = TraceEventLevel.Always,
|
Level = TraceEventLevel.Always,
|
||||||
Keywords = TplActivities.TaskFlowActivityIdsKeyword
|
Keywords = TplActivities.TaskFlowActivityIdsKeyword,
|
||||||
};
|
};
|
||||||
this.EnableProvider(tplProviderRequest);
|
this.EnableProvider(tplProviderRequest);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
namespace Microsoft.ApplicationInsights.EtwCollector
|
namespace Microsoft.ApplicationInsights.EtwCollector
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using Diagnostics.Tracing.Session;
|
|
||||||
using Microsoft.Diagnostics.Tracing;
|
using Microsoft.Diagnostics.Tracing;
|
||||||
|
using Microsoft.Diagnostics.Tracing.Session;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abstracts properties and methods of <see cref="Microsoft.Diagnostics.Tracing.Session.TraceEventSession"/> to provide better test ability.
|
/// Abstracts properties and methods of <see cref="Microsoft.Diagnostics.Tracing.Session.TraceEventSession"/> to provide better test ability.
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Microsoft.ApplicationInsights.EtwCollector.Implemenetation
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using DataContracts;
|
using Microsoft.ApplicationInsights.DataContracts;
|
||||||
using Microsoft.ApplicationInsights.TraceEvent.Shared.Utilities;
|
using Microsoft.ApplicationInsights.TraceEvent.Shared.Utilities;
|
||||||
using Microsoft.Diagnostics.Tracing;
|
using Microsoft.Diagnostics.Tracing;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace Microsoft.ApplicationInsights.EtwCollector.Implemenetation
|
||||||
SeverityLevel.Error, // TraceEventLevel.Error == 2
|
SeverityLevel.Error, // TraceEventLevel.Error == 2
|
||||||
SeverityLevel.Warning, // TraceEventLevel.Warning == 3
|
SeverityLevel.Warning, // TraceEventLevel.Warning == 3
|
||||||
SeverityLevel.Information, // TraceEventLevel.Informational == 4
|
SeverityLevel.Information, // TraceEventLevel.Informational == 4
|
||||||
SeverityLevel.Verbose // TraceEventLevel.Verbose == 5
|
SeverityLevel.Verbose, // TraceEventLevel.Verbose == 5
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void Track(this TraceEvent traceEvent, TelemetryClient client)
|
public static void Track(this TraceEvent traceEvent, TelemetryClient client)
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
|
<PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.ApplicationInsights.EventSourceListener
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="EventSourceTelemetryModule"/> class.
|
/// Initializes a new instance of the <see cref="EventSourceTelemetryModule"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="onEventWrittenHandler">Action to be executed each time an event is written to format and send via the configured <see cref="TelemetryClient"/></param>
|
/// <param name="onEventWrittenHandler">Action to be executed each time an event is written to format and send via the configured <see cref="TelemetryClient"/>.</param>
|
||||||
public EventSourceTelemetryModule(OnEventWrittenHandler onEventWrittenHandler)
|
public EventSourceTelemetryModule(OnEventWrittenHandler onEventWrittenHandler)
|
||||||
{
|
{
|
||||||
if (onEventWrittenHandler == null)
|
if (onEventWrittenHandler == null)
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0-beta4" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.2">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta009">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
|
|
|
@ -66,10 +66,10 @@ namespace Microsoft.ApplicationInsights.Log4NetAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flushes any buffered log data
|
/// Flushes any buffered log data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="millisecondsTimeout">The maximum time to wait for logging events to be flushed</param>
|
/// <param name="millisecondsTimeout">The maximum time to wait for logging events to be flushed.</param>
|
||||||
/// <returns>True if all logging events were flushed successfully, else false</returns>
|
/// <returns>True if all logging events were flushed successfully, else false.</returns>
|
||||||
public override bool Flush(int millisecondsTimeout)
|
public override bool Flush(int millisecondsTimeout)
|
||||||
{
|
{
|
||||||
this.telemetryClient.Flush();
|
this.telemetryClient.Flush();
|
||||||
|
@ -183,7 +183,7 @@ namespace Microsoft.ApplicationInsights.Log4NetAppender
|
||||||
{
|
{
|
||||||
var exceptionTelemetry = new ExceptionTelemetry(loggingEvent.ExceptionObject)
|
var exceptionTelemetry = new ExceptionTelemetry(loggingEvent.ExceptionObject)
|
||||||
{
|
{
|
||||||
SeverityLevel = GetSeverityLevel(loggingEvent.Level)
|
SeverityLevel = GetSeverityLevel(loggingEvent.Level),
|
||||||
};
|
};
|
||||||
|
|
||||||
string message = null;
|
string message = null;
|
||||||
|
@ -215,7 +215,7 @@ namespace Microsoft.ApplicationInsights.Log4NetAppender
|
||||||
|
|
||||||
var trace = new TraceTelemetry(message)
|
var trace = new TraceTelemetry(message)
|
||||||
{
|
{
|
||||||
SeverityLevel = GetSeverityLevel(loggingEvent.Level)
|
SeverityLevel = GetSeverityLevel(loggingEvent.Level),
|
||||||
};
|
};
|
||||||
|
|
||||||
BuildCustomProperties(loggingEvent, trace);
|
BuildCustomProperties(loggingEvent, trace);
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.ApplicationInsights.NLogTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the array of custom attributes to be passed into the logevent context
|
/// Gets the array of custom attributes to be passed into the logevent context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ArrayParameter(typeof(TargetPropertyWithContext), "contextproperty")]
|
[ArrayParameter(typeof(TargetPropertyWithContext), "contextproperty")]
|
||||||
public IList<TargetPropertyWithContext> ContextProperties { get; } = new List<TargetPropertyWithContext>();
|
public IList<TargetPropertyWithContext> ContextProperties { get; } = new List<TargetPropertyWithContext>();
|
||||||
|
@ -148,9 +148,9 @@ namespace Microsoft.ApplicationInsights.NLogTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flush any pending log messages
|
/// Flush any pending log messages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="asyncContinuation">The asynchronous continuation</param>
|
/// <param name="asyncContinuation">The asynchronous continuation.</param>
|
||||||
protected override void FlushAsync(AsyncContinuation asyncContinuation)
|
protected override void FlushAsync(AsyncContinuation asyncContinuation)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -249,7 +249,7 @@ namespace Microsoft.ApplicationInsights.NLogTarget
|
||||||
{
|
{
|
||||||
var exceptionTelemetry = new ExceptionTelemetry(logEvent.Exception)
|
var exceptionTelemetry = new ExceptionTelemetry(logEvent.Exception)
|
||||||
{
|
{
|
||||||
SeverityLevel = GetSeverityLevel(logEvent.Level)
|
SeverityLevel = GetSeverityLevel(logEvent.Level),
|
||||||
};
|
};
|
||||||
|
|
||||||
string logMessage = this.Layout.Render(logEvent);
|
string logMessage = this.Layout.Render(logEvent);
|
||||||
|
@ -265,7 +265,7 @@ namespace Microsoft.ApplicationInsights.NLogTarget
|
||||||
|
|
||||||
var trace = new TraceTelemetry(logMessage)
|
var trace = new TraceTelemetry(logMessage)
|
||||||
{
|
{
|
||||||
SeverityLevel = GetSeverityLevel(logEvent.Level)
|
SeverityLevel = GetSeverityLevel(logEvent.Level),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.BuildPropertyBag(logEvent, trace);
|
this.BuildPropertyBag(logEvent, trace);
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Microsoft.ApplicationInsights.NLogTarget
|
||||||
using NLog.Layouts;
|
using NLog.Layouts;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// NLog Target Context Property that allows capture of context information for all logevents (Ex. Layout=${threadid})
|
/// NLog Target Context Property that allows capture of context information for all logevents (Ex. Layout=${threadid}).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[NLogConfigurationItem]
|
[NLogConfigurationItem]
|
||||||
[ThreadAgnostic]
|
[ThreadAgnostic]
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
<PackageReference Include="Desktop.Analyzers" Version="1.1.0">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
<PackageReference Include="MicroBuild.Core" Version="0.3.0">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче