@@ -37,6 +37,8 @@ public class CSharpFunctionInvoker : FunctionInvokerBase
37
37
private readonly IFunctionEntryPointResolver _functionEntryPointResolver ;
38
38
private readonly IMetricsLogger _metrics ;
39
39
private readonly ReaderWriterLockSlim _functionValueLoaderLock = new ReaderWriterLockSlim ( ) ;
40
+ // TODO:Get this from some context set in/by the host.
41
+ private bool _compileWithDebugOptmization = true ;
40
42
41
43
private CSharpFunctionSignature _functionSignature ;
42
44
private IFunctionMetadataResolver _metadataResolver ;
@@ -113,7 +115,7 @@ private void ReloadScript()
113
115
TraceWriter . Verbose ( "Compiling function script." ) ;
114
116
115
117
Script < object > script = CreateScript ( ) ;
116
- Compilation compilation = script . GetCompilation ( ) ;
118
+ Compilation compilation = GetScriptCompilation ( script , _compileWithDebugOptmization ) ;
117
119
ImmutableArray < Diagnostic > compilationResult = compilation . GetDiagnostics ( ) ;
118
120
119
121
CSharpFunctionSignature signature = CSharpFunctionSignature . FromCompilation ( compilation , _functionEntryPointResolver ) ;
@@ -288,15 +290,13 @@ internal async Task<MethodInfo> GetFunctionTargetAsync(int attemptCount = 0)
288
290
289
291
private MethodInfo CreateFunctionTarget ( CancellationToken cancellationToken )
290
292
{
291
- // TODO:Get this from some context set in/by the host.
292
- bool debug = true ;
293
293
MemoryStream assemblyStream = null ;
294
294
MemoryStream pdbStream = null ;
295
295
296
296
try
297
297
{
298
298
Script < object > script = CreateScript ( ) ;
299
- Compilation compilation = GetScriptCompilation ( script , debug ) ;
299
+ Compilation compilation = GetScriptCompilation ( script , _compileWithDebugOptmization ) ;
300
300
CSharpFunctionSignature functionSignature = CSharpFunctionSignature . FromCompilation ( compilation , _functionEntryPointResolver ) ;
301
301
302
302
ValidateFunctionBindingArguments ( functionSignature , throwIfFailed : true ) ;
0 commit comments