Skip to content

Commit

Permalink
Fix warnings introduced by .NET 8 migration
Browse files Browse the repository at this point in the history
[skip-release]
  • Loading branch information
gabrielweyer committed Nov 18, 2023
1 parent 3ee2ef0 commit 7eacaec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static IServiceCollection AddCustomApplicationInsights(
return services;
}

#pragma warning disable CA1510 // I still have to support netstandard 2.1
if (config == null)
{
throw new ArgumentNullException(nameof(config));
Expand All @@ -44,6 +45,7 @@ public static IServiceCollection AddCustomApplicationInsights(
{
throw new ArgumentNullException(nameof(services));
}
#pragma warning restore CA1510

if (!string.IsNullOrWhiteSpace(config.ApplicationName))
{
Expand All @@ -62,7 +64,7 @@ public static IServiceCollection AddCustomApplicationInsights(
var serviceBusTriggeredFunctionName = FunctionsFinder
.GetServiceBusTriggeredFunctionNames(config.TypeFromEntryAssembly);

if (serviceBusTriggeredFunctionName.Any())
if (serviceBusTriggeredFunctionName.Count != 0)
{
services.AddSingleton<ITelemetryInitializer, ServiceBusRequestInitializer>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public void GivenApplicationNameProvided_ThenRegisterApplicationInitializer()
registeredTelemetryInitializers.Should().Contain(typeof(ApplicationInitializer));
}

private static IReadOnlyList<Type> GetTelemetryInitializers(IServiceCollection serviceCollection)
#pragma warning disable CS8619 // I have to support both .NET Core 3.1 and .NET 6
private static List<Type> GetTelemetryInitializers(IServiceCollection serviceCollection)
{
return serviceCollection
.Where(s => s.ServiceType == typeof(ITelemetryInitializer) && s.ImplementationType != null)
.Select(s => s.ImplementationType)
.ToList()!;
.ToList();
}
#pragma warning restore CS8619
}

0 comments on commit 7eacaec

Please sign in to comment.