@@ -36,29 +36,37 @@ public sealed class ScriptStartupTypeLocator : IWebJobsStartupTypeLocator
36
36
private readonly IExtensionBundleManager _extensionBundleManager ;
37
37
private readonly IFunctionMetadataManager _functionMetadataManager ;
38
38
private readonly IMetricsLogger _metricsLogger ;
39
- private readonly Lazy < IEnumerable < Type > > _startupTypes ;
39
+ private readonly IEnvironment _environment ;
40
40
private readonly IOptions < ExtensionRequirementOptions > _extensionRequirementOptions ;
41
+ private readonly Lazy < IEnumerable < Type > > _startupTypes ;
41
42
private static string [ ] _builtinExtensionAssemblies = GetBuiltinExtensionAssemblies ( ) ;
42
43
43
- public ScriptStartupTypeLocator ( string rootScriptPath , ILogger < ScriptStartupTypeLocator > logger , IExtensionBundleManager extensionBundleManager ,
44
- IFunctionMetadataManager functionMetadataManager , IMetricsLogger metricsLogger , IOptions < ExtensionRequirementOptions > extensionRequirementOptions )
44
+ public ScriptStartupTypeLocator (
45
+ string rootScriptPath ,
46
+ ILogger < ScriptStartupTypeLocator > logger ,
47
+ IExtensionBundleManager extensionBundleManager ,
48
+ IFunctionMetadataManager functionMetadataManager ,
49
+ IMetricsLogger metricsLogger ,
50
+ IEnvironment environment ,
51
+ IOptions < ExtensionRequirementOptions > extensionRequirementOptions )
45
52
{
46
53
_rootScriptPath = rootScriptPath ?? throw new ArgumentNullException ( nameof ( rootScriptPath ) ) ;
47
54
_extensionBundleManager = extensionBundleManager ?? throw new ArgumentNullException ( nameof ( extensionBundleManager ) ) ;
48
55
_logger = logger ;
49
56
_functionMetadataManager = functionMetadataManager ;
50
57
_metricsLogger = metricsLogger ;
51
- _startupTypes = new Lazy < IEnumerable < Type > > ( ( ) => GetExtensionsStartupTypesAsync ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) ) ;
58
+ _environment = environment ;
52
59
_extensionRequirementOptions = extensionRequirementOptions ;
60
+ _startupTypes = new Lazy < IEnumerable < Type > > ( ( ) => GetExtensionsStartupTypesAsync ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) ) ;
53
61
}
54
62
55
63
private static string [ ] GetBuiltinExtensionAssemblies ( )
56
64
{
57
- return new [ ]
58
- {
65
+ return
66
+ [
59
67
typeof ( WebJobs . Extensions . Http . HttpWebJobsStartup ) . Assembly . GetName ( ) . Name ,
60
68
typeof ( WebJobs . Extensions . ExtensionsWebJobsStartup ) . Assembly . GetName ( ) . Name
61
- } ;
69
+ ] ;
62
70
}
63
71
64
72
public Type [ ] GetStartupTypes ( )
@@ -102,11 +110,11 @@ public async Task<IEnumerable<Type>> GetExtensionsStartupTypesAsync()
102
110
}
103
111
}
104
112
105
- bool isDotnetIsolatedApp = Utility . IsDotnetIsolatedApp ( SystemEnvironment . Instance , functionMetadataCollection ) ;
113
+ bool isDotnetIsolatedApp = Utility . IsDotnetIsolatedApp ( _environment , functionMetadataCollection ) ;
106
114
bool isDotnetApp = isPrecompiledFunctionApp || isDotnetIsolatedApp ;
107
- var isLogicApp = SystemEnvironment . Instance . IsLogicApp ( ) ;
115
+ var isLogicApp = _environment . IsLogicApp ( ) ;
108
116
109
- if ( SystemEnvironment . Instance . IsPlaceholderModeEnabled ( ) )
117
+ if ( _environment . IsPlaceholderModeEnabled ( ) )
110
118
{
111
119
// Do not move this.
112
120
// Calling this log statement in the placeholder mode to avoid jitting during specialization
0 commit comments