This repository was archived by the owner on Dec 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/Microsoft.AspNet.Hosting Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 8
8
using Microsoft . Framework . ConfigurationModel ;
9
9
using Microsoft . Framework . DependencyInjection ;
10
10
using Microsoft . Framework . DependencyInjection . Fallback ;
11
+ using Microsoft . Framework . Logging ;
11
12
using Microsoft . Framework . Runtime ;
12
13
13
14
namespace Microsoft . AspNet . Hosting
@@ -52,14 +53,23 @@ public void Main(string[] args)
52
53
} ;
53
54
54
55
var engine = services . GetRequiredService < IHostingEngine > ( ) ;
56
+ var loggerFactory = services . GetRequiredService < ILoggerFactory > ( ) ;
55
57
var appShutdownService = _serviceProvider . GetRequiredService < IApplicationShutdown > ( ) ;
56
58
var shutdownHandle = new ManualResetEvent ( false ) ;
57
59
58
60
var serverShutdown = engine . Start ( context ) ;
59
61
60
62
appShutdownService . ShutdownRequested . Register ( ( ) =>
61
63
{
62
- serverShutdown . Dispose ( ) ;
64
+ try
65
+ {
66
+ serverShutdown . Dispose ( ) ;
67
+ }
68
+ catch ( Exception ex )
69
+ {
70
+ var logger = loggerFactory . Create < Program > ( ) ;
71
+ logger . WriteError ( "TODO: Dispose threw an exception" , ex ) ;
72
+ }
63
73
shutdownHandle . Set ( ) ;
64
74
} ) ;
65
75
You can’t perform that action at this time.
0 commit comments