Skip to content

Commit c2e3fd1

Browse files
committed
Fixing host disposal issue (#1173)
1 parent e279f26 commit c2e3fd1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,25 +1211,25 @@ internal static string GetAssemblyFileVersion(Assembly assembly)
12111211

12121212
protected override void Dispose(bool disposing)
12131213
{
1214-
base.Dispose(disposing);
1215-
12161214
if (disposing)
12171215
{
1216+
(TraceWriter as IDisposable)?.Dispose();
1217+
#if FEATURE_NODE
1218+
NodeFunctionInvoker.UnhandledException -= OnUnhandledException;
1219+
#endif
12181220
_scriptFileWatcher?.Dispose();
12191221
_debugModeFileWatcher?.Dispose();
1222+
_blobLeaseManager?.Dispose();
12201223

12211224
foreach (var function in Functions)
12221225
{
12231226
(function.Invoker as IDisposable)?.Dispose();
12241227
}
1225-
1226-
_blobLeaseManager?.Dispose();
1227-
(TraceWriter as IDisposable)?.Dispose();
1228-
1229-
#if FEATURE_NODE
1230-
NodeFunctionInvoker.UnhandledException -= OnUnhandledException;
1231-
#endif
12321228
}
1229+
1230+
// dispose base last to ensure that errors there don't
1231+
// cause us to not dispose ourselves
1232+
base.Dispose(disposing);
12331233
}
12341234
}
12351235
}

0 commit comments

Comments
 (0)