Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Allow no ApplicationName when GetEntryAssembly is null
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Aug 20, 2017
1 parent e519f74 commit 3599d25
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ public static void Initialize(this IHostingEnvironment hostingEnvironment, strin
{
throw new ArgumentNullException(nameof(options));
}
if (string.IsNullOrEmpty(applicationName))
{
throw new ArgumentException("A valid non-empty application name must be provided.", nameof(applicationName));
}
if (string.IsNullOrEmpty(contentRootPath))
{
throw new ArgumentException("A valid non-empty content root must be provided.", nameof(contentRootPath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public WebHostOptions(IConfiguration configuration)
if (string.IsNullOrEmpty(startupAssembly))
{
// Fall back to entry assembly name if startup assembly hasn't been set.
startupAssembly = Assembly.GetEntryAssembly().GetName().Name;
startupAssembly = Assembly.GetEntryAssembly()?.GetName().Name;
}

var applicationName = configuration[WebHostDefaults.ApplicationKey];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ public void DefaultApplicationNameWithInjectedIStartup()
.Build())
{
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
Assert.Equal(Assembly.GetEntryAssembly().GetName().Name, hostingEnv.ApplicationName);
Assert.Equal(Assembly.GetEntryAssembly()?.GetName().Name, hostingEnv.ApplicationName);
}
}

Expand Down

0 comments on commit 3599d25

Please sign in to comment.