Skip to content

Commit

Permalink
Enable nullable for HostFactoryResolver.Tests (#103609)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericstj authored Jun 23, 2024
1 parent d8f796b commit 0fc2809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ public void ApplicationNameSetFromArgument()
{
Assembly assembly = Assembly.Load("ApplicationNameSetFromArgument");
var factory = HostFactoryResolver.ResolveServiceProviderFactory(assembly, s_WaitTimeout);
Assert.NotNull(factory);
IServiceProvider? serviceProvider = factory(Array.Empty<string>());
Assert.NotNull(serviceProvider);

var configuration = (IConfiguration)serviceProvider.GetService(typeof(IConfiguration));
var configuration = (IConfiguration?)serviceProvider.GetService(typeof(IConfiguration));
Assert.NotNull(configuration);
Assert.Equal("ApplicationNameSetFromArgument", configuration["applicationName"]);
}

Expand All @@ -284,7 +287,7 @@ public void NoSpecialEntryPointPatternCanRunInParallel()
var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(NoSpecialEntryPointPattern.Program).Assembly, s_WaitTimeout);
Assert.NotNull(factory);

var tasks = new Task<IServiceProvider>[30];
var tasks = new Task<IServiceProvider?>[30];
int index = 0;
for (int i = 0; i < tasks.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 0fc2809

Please sign in to comment.