Skip to content

Commit 757ff14

Browse files
TheConstructornatemcmaster
authored andcommitted
Make IUnhandledExceptionHandler optional and always call StopApplication (#199)
1 parent ba2d69d commit 757ff14

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Hosting.CommandLine/Internal/CommandLineLifetime.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal class CommandLineLifetime : IHostLifetime, IDisposable
2828
public CommandLineLifetime(IApplicationLifetime applicationLifetime,
2929
ICommandLineService cliService,
3030
IConsole console,
31-
IUnhandledExceptionHandler unhandledExceptionHandler)
31+
IUnhandledExceptionHandler unhandledExceptionHandler = null)
3232
{
3333
_applicationLifetime = applicationLifetime;
3434
_cliService = cliService;
@@ -75,8 +75,10 @@ public Task WaitForStartAsync(CancellationToken cancellationToken)
7575
ExceptionDispatchInfo.Capture(e).Throw();
7676
}
7777
}
78-
79-
_applicationLifetime.StopApplication();
78+
finally
79+
{
80+
_applicationLifetime.StopApplication();
81+
}
8082
});
8183

8284
// Ensures services are disposed before the application exits.

0 commit comments

Comments
 (0)