From 9b30992b490a4b52bbbc5299c9ef365ecfb95367 Mon Sep 17 00:00:00 2001 From: netpyoung Date: Tue, 19 Nov 2024 06:57:52 +0900 Subject: [PATCH] adjust optimize level when options.IncludeDebuggingInfo is true. --- RazorEngineCore/RazorEngine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RazorEngineCore/RazorEngine.cs b/RazorEngineCore/RazorEngine.cs index 672d41b..eefa62b 100644 --- a/RazorEngineCore/RazorEngine.cs +++ b/RazorEngineCore/RazorEngine.cs @@ -107,7 +107,7 @@ protected virtual RazorEngineCompiledTemplateMeta CreateAndCompileToStream(strin .Concat(options.MetadataReferences) .ToList(), new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) - .WithOptimizationLevel(OptimizationLevel.Release) + .WithOptimizationLevel(options.IncludeDebuggingInfo ? OptimizationLevel.Debug : OptimizationLevel.Release) .WithOverflowChecks(true));