public static CSharpCompilation CreateCompilation( IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references = null, CSharpCompilationOptions options = null, string assemblyName = "") { if (options == null) { options = TestOptions.ReleaseDll; } // Using single-threaded build if debugger attached, to simplify debugging. if (Debugger.IsAttached) { options = options.WithConcurrentBuild(false); } #if Test_IOperation_Interface // Create a compilation for the purpose of verifying operation tree only, // so this won't interfere with test. var compilationForOperationWalking = CSharpCompilation.Create( assemblyName == "" ? GetUniqueName() : assemblyName, trees, references, options); WalkOperationTree(compilationForOperationWalking); #endif return(CSharpCompilation.Create( assemblyName == "" ? GetUniqueName() : assemblyName, trees, references, options)); }
public static CSharpCompilation CreateCompilation( IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references = null, CSharpCompilationOptions options = null, string assemblyName = "") { if (options == null) { options = TestOptions.ReleaseDll; } // Using single-threaded build if debugger attached, to simplify debugging. if (Debugger.IsAttached) { options = options.WithConcurrentBuild(false); } Func <CSharpCompilation> createCompilationLambda = () => CSharpCompilation.Create( assemblyName == "" ? GetUniqueName() : assemblyName, trees, references, options); return(createCompilationLambda()); }
public void Serializability2() { var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp3, DocumentationMode.Diagnose, SourceCodeKind.Interactive); var compilationOptions = new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, moduleName: "M", optimizationLevel: OptimizationLevel.Release); compilationOptions = compilationOptions. WithConcurrentBuild(!compilationOptions.ConcurrentBuild). WithExtendedCustomDebugInformation(!compilationOptions.ExtendedCustomDebugInformation); var deserializedCompilationOptions = VerifySerializability(new CSharpSerializableCompilationOptions(compilationOptions)).Options; Assert.Equal(compilationOptions.OutputKind, deserializedCompilationOptions.OutputKind); Assert.Equal(compilationOptions.ModuleName, deserializedCompilationOptions.ModuleName); Assert.Equal(compilationOptions.OptimizationLevel, deserializedCompilationOptions.OptimizationLevel); Assert.Equal(compilationOptions.ConcurrentBuild, deserializedCompilationOptions.ConcurrentBuild); Assert.Equal(compilationOptions.ExtendedCustomDebugInformation, deserializedCompilationOptions.ExtendedCustomDebugInformation); }
public static CSharpCompilation CreateCompilation( IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references = null, CSharpCompilationOptions compOptions = null, string assemblyName = "") { if (compOptions == null) { compOptions = TestOptions.Dll.WithOptimizations(true); } // Using single-threaded build if debugger attached, to simplify debugging. if (Debugger.IsAttached) { compOptions = compOptions.WithConcurrentBuild(false); } return(CSharpCompilation.Create( assemblyName == "" ? GetUniqueName() : assemblyName, trees, references, compOptions)); }