From cfc9913812795b6bf6631d7383f8d0ea7bf14321 Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Mon, 19 Aug 2024 12:48:39 +0200 Subject: [PATCH] Enable nullable context in C# compilation --- Bot/Sharp/Compilation/CSharpCompiler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Bot/Sharp/Compilation/CSharpCompiler.cs b/Bot/Sharp/Compilation/CSharpCompiler.cs index f807065..191cc9d 100644 --- a/Bot/Sharp/Compilation/CSharpCompiler.cs +++ b/Bot/Sharp/Compilation/CSharpCompiler.cs @@ -10,12 +10,14 @@ public class CSharpCompiler : RoslynCompiler private static readonly CSharpCompilationOptions _executableOptions = new( outputKind: OutputKind.ConsoleApplication, optimizationLevel: OptimizationLevel.Release, - allowUnsafe: true); + allowUnsafe: true, + nullableContextOptions: NullableContextOptions.Enable); private static readonly CSharpCompilationOptions _libraryOptions = new( outputKind: OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release, - allowUnsafe: true); + allowUnsafe: true, + nullableContextOptions: NullableContextOptions.Enable); private static CSharpCompilationOptions GetOptions(SyntaxTree syntaxTree, CompilationOutput? output) {