@@ -170,17 +170,17 @@ public bool CanInvoke()
170
170
171
171
newInstance = _scriptHostFactory . Create ( _environment , EventManager , _settingsManager , _config ) ;
172
172
_currentInstance = newInstance ;
173
- lock ( _liveInstances )
174
- {
175
- _liveInstances . Add ( newInstance ) ;
176
- _hostStartCount ++ ;
177
- }
178
173
179
174
newInstance . HostInitializing += OnHostInitializing ;
180
175
newInstance . HostInitialized += OnHostInitialized ;
181
176
newInstance . HostStarted += OnHostStarted ;
182
177
newInstance . Initialize ( ) ;
183
178
179
+ lock ( _liveInstances )
180
+ {
181
+ _liveInstances . Add ( newInstance ) ;
182
+ }
183
+
184
184
newInstance . StartAsync ( cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
185
185
186
186
// log any function initialization errors
@@ -286,7 +286,7 @@ private void OnHostInitializing(object sender, EventArgs e)
286
286
var host = ( ScriptHost ) sender ;
287
287
string extensionVersion = _settingsManager . GetSetting ( EnvironmentSettingNames . FunctionsExtensionVersion ) ;
288
288
string hostId = host . ScriptConfig . HostConfig . HostId ;
289
- string message = $ "Starting Host (HostId={ hostId } , Version={ ScriptHost . Version } , InstanceId={ host . InstanceId } , ProcessId={ Process . GetCurrentProcess ( ) . Id } , AppDomainId={ AppDomain . CurrentDomain . Id } , Debug={ host . InDebugMode } , ConsecutiveErrors={ _consecutiveErrorCount } , StartupCount={ _hostStartCount } , FunctionsExtensionVersion={ extensionVersion } )";
289
+ string message = $ "Starting Host (HostId={ hostId } , Version={ ScriptHost . Version } , InstanceId={ host . InstanceId } , ProcessId={ Process . GetCurrentProcess ( ) . Id } , AppDomainId={ AppDomain . CurrentDomain . Id } , Debug={ host . InDebugMode } , ConsecutiveErrors={ _consecutiveErrorCount } , StartupCount={ ++ _hostStartCount } , FunctionsExtensionVersion={ extensionVersion } )";
290
290
host . TraceWriter . Info ( message ) ;
291
291
host . Logger . LogInformation ( message ) ;
292
292
0 commit comments