diff --git a/BASE/src/Microsoft.ApplicationInsights/Channel/Transmission.cs b/BASE/src/Microsoft.ApplicationInsights/Channel/Transmission.cs
index e95b80962f..f6510e8f24 100644
--- a/BASE/src/Microsoft.ApplicationInsights/Channel/Transmission.cs
+++ b/BASE/src/Microsoft.ApplicationInsights/Channel/Transmission.cs
@@ -23,19 +23,11 @@ public class Transmission
internal const string ContentEncodingHeader = "Content-Encoding";
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(100);
- private static HttpClient client;
+ private static HttpClient client = new HttpClient(new RedirectHttpHandler()) { Timeout = System.Threading.Timeout.InfiniteTimeSpan };
private static long flushAsyncCounter = 0;
private int isSending;
- static Transmission()
- {
- client = new HttpClient(new RedirectHttpHandler())
- {
- Timeout = System.Threading.Timeout.InfiniteTimeSpan,
- };
- }
-
///
/// Initializes a new instance of the class.
///
diff --git a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Authentication/ReflectionCredentialEnvelope.cs b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Authentication/ReflectionCredentialEnvelope.cs
index 67b68fe9a4..74069257e1 100644
--- a/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Authentication/ReflectionCredentialEnvelope.cs
+++ b/BASE/src/Microsoft.ApplicationInsights/Extensibility/Implementation/Authentication/ReflectionCredentialEnvelope.cs
@@ -123,7 +123,7 @@ private static Type GetTokenCredentialType()
if (typeTokenCredential == null)
{
- if (AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(azureCoreAssemblyName)))
+ if (AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(azureCoreAssemblyName, StringComparison.Ordinal)))
{
throw new Exception("An unknown error has occurred. Failed to get type Azure.Core.TokenCredential. Detected that Azure.Core is loaded in AppDomain.CurrentDomain.");
}
diff --git a/BASE/src/ServerTelemetryChannel/Implementation/TransmissionPolicy/TransmissionPolicyCollection.cs b/BASE/src/ServerTelemetryChannel/Implementation/TransmissionPolicy/TransmissionPolicyCollection.cs
index b797272d47..fea05492f5 100644
--- a/BASE/src/ServerTelemetryChannel/Implementation/TransmissionPolicy/TransmissionPolicyCollection.cs
+++ b/BASE/src/ServerTelemetryChannel/Implementation/TransmissionPolicy/TransmissionPolicyCollection.cs
@@ -9,6 +9,8 @@ internal class TransmissionPolicyCollection : IDisposable
{
private readonly IEnumerable policies;
private bool isDisposed;
+
+ [SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "All policies are stored in the IEnumerable and are properly disposed.")]
private AuthenticationTransmissionPolicy authenticationTransmissionPolicy;
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "applicationLifecycle is required only for NetFramework.")]
diff --git a/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs b/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs
index 8e3c8133d7..7d47ea4355 100644
--- a/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs
+++ b/BASE/src/ServerTelemetryChannel/ServerTelemetryChannel.cs
@@ -283,6 +283,7 @@ public void Dispose()
// Tested by FxCop rule CA2213
this.TelemetryBuffer.Dispose();
this.Transmitter.Dispose();
+ this.policies.Dispose();
}
///
diff --git a/WEB/Src/DependencyCollector/DependencyCollector/DependencyTrackingTelemetryModule.cs b/WEB/Src/DependencyCollector/DependencyCollector/DependencyTrackingTelemetryModule.cs
index dbf2b9ef3d..2f35cf5a55 100644
--- a/WEB/Src/DependencyCollector/DependencyCollector/DependencyTrackingTelemetryModule.cs
+++ b/WEB/Src/DependencyCollector/DependencyCollector/DependencyTrackingTelemetryModule.cs
@@ -282,7 +282,7 @@ protected virtual void Dispose(bool disposing)
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
private static void PrepareFirstActivity()
{
- var activity = new Activity("Microsoft.ApplicationInsights.Init");
+ using var activity = new Activity("Microsoft.ApplicationInsights.Init");
activity.Start();
activity.Stop();
}