60 instantiations of CSharpCompilationOptions
ConfigurationSchemaGenerator.Tests (1)
GeneratorTests.cs (1)
1562var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable);
Infrastructure.Tests (1)
ExtractTestPartitions\MockAssemblyBuilder.cs (1)
262new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
Microsoft.Analyzers.Extra.Tests (3)
Resources\RoslynTestUtils.cs (3)
59.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) 252proj = proj.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.ConsoleApplication)); 319proj = proj.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.ConsoleApplication));
Microsoft.Analyzers.Local.Tests (3)
Resources\RoslynTestUtils.cs (3)
59.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) 252proj = proj.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.ConsoleApplication)); 320proj = proj.WithCompilationOptions(new CSharpCompilationOptions(OutputKind.ConsoleApplication));
Microsoft.CodeAnalysis.CSharp (38)
CommandLine\CSharpCommandLineParser.cs (1)
1518var options = new CSharpCompilationOptions
Compilation\CSharpCompilation.cs (2)
427private static readonly CSharpCompilationOptions s_defaultOptions = new CSharpCompilationOptions(OutputKind.ConsoleApplication); 428private static readonly CSharpCompilationOptions s_defaultSubmissionOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithReferencesSupersedeLowerVersions(true);
CSharpCompilationOptions.cs (35)
282return (flags == TopLevelBinderFlags) ? this : new CSharpCompilationOptions(this) { TopLevelBinderFlags = flags }; 296return new CSharpCompilationOptions(this) { OutputKind = kind }; 306return new CSharpCompilationOptions(this) { ModuleName = moduleName }; 316return new CSharpCompilationOptions(this) { ScriptClassName = name }; 326return new CSharpCompilationOptions(this) { MainTypeName = name }; 336return new CSharpCompilationOptions(this) { CryptoKeyContainer = name }; 351return new CSharpCompilationOptions(this) { CryptoKeyFile = path }; 366return new CSharpCompilationOptions(this) { CryptoPublicKey = value }; 376return new CSharpCompilationOptions(this) { DelaySign = value }; 386return new CSharpCompilationOptions(this) { Usings = usings }; 390new CSharpCompilationOptions(this) { Usings = usings.AsImmutableOrEmpty() }; 401return new CSharpCompilationOptions(this) { OptimizationLevel = value }; 411return new CSharpCompilationOptions(this) { CheckOverflow = enabled }; 421return new CSharpCompilationOptions(this) { NullableContextOptions = options }; 431return new CSharpCompilationOptions(this) { AllowUnsafe = enabled }; 442return new CSharpCompilationOptions(this) { MemorySafetyRules = version }; 460return new CSharpCompilationOptions(this) { Platform = platform }; 470return new CSharpCompilationOptions(this) { PublicSign = publicSign }; 491return new CSharpCompilationOptions(this) { GeneralDiagnosticOption = value }; 506return new CSharpCompilationOptions(this) { SpecificDiagnosticOptions = values }; 510new CSharpCompilationOptions(this) { SpecificDiagnosticOptions = values.ToImmutableDictionaryOrEmpty() }; 519return new CSharpCompilationOptions(this) { ReportSuppressedDiagnostics = reportSuppressedDiagnostics }; 529return new CSharpCompilationOptions(this) { WarningLevel = warningLevel }; 539return new CSharpCompilationOptions(this) { ConcurrentBuild = concurrentBuild }; 549return new CSharpCompilationOptions(this) { Deterministic = deterministic }; 559return new CSharpCompilationOptions(this) { CurrentLocalTime = value }; 569return new CSharpCompilationOptions(this) { DebugPlusMode = debugPlusMode }; 579return new CSharpCompilationOptions(this) { MetadataImportOptions = value }; 589return new CSharpCompilationOptions(this) { ReferencesSupersedeLowerVersions = value }; 599return new CSharpCompilationOptions(this) { XmlReferenceResolver = resolver }; 609return new CSharpCompilationOptions(this) { SourceReferenceResolver = resolver }; 619return new CSharpCompilationOptions(this) { SyntaxTreeOptionsProvider = provider }; 629return new CSharpCompilationOptions(this) { MetadataReferenceResolver = resolver }; 641return new CSharpCompilationOptions(this) { AssemblyIdentityComparer = comparer }; 651return new CSharpCompilationOptions(this) { StrongNameProvider = provider };
Microsoft.CodeAnalysis.CSharp.Scripting (1)
CSharpScriptCompiler.cs (1)
56WithTopLevelBinderFlags(new CSharpCompilationOptions(
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Serialization\CSharpOptionsSerializationService.cs (1)
58return new CSharpCompilationOptions(
Workspace\LanguageServices\CSharpCompilationFactoryService.cs (2)
18private static readonly CSharpCompilationOptions s_defaultOptions = new(OutputKind.ConsoleApplication, concurrentBuild: false); 53return new CSharpCompilationOptions(outputKind: outputKind);
Microsoft.CodeAnalysis.Rebuild (1)
CSharpCompilationFactory.cs (1)
87var compilationOptions = new CSharpCompilationOptions(
Microsoft.DotNet.ApiSymbolExtensions (1)
AssemblySymbolLoader.cs (1)
118CSharpCompilationOptions compilationOptions = new(
Microsoft.Gen.BuildMetadata.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.Logging.Unit.Tests (2)
CompilationHelper.cs (1)
51options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.Metrics.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
Microsoft.Gen.MetricsReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
84new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable));
110 references to CSharpCompilationOptions
ConfigurationSchemaGenerator.Tests (1)
GeneratorTests.cs (1)
1562var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable);
Microsoft.CodeAnalysis.CSharp (66)
Binder\Binder_Unsafe.cs (1)
319/// <see cref="CSharpCompilationOptions.UseUpdatedMemorySafetyRules"/>
CommandLine\CSharpCommandLineArguments.cs (1)
16public new CSharpCompilationOptions CompilationOptions { get; internal set; }
CommandLine\CSharpCommandLineParser.cs (1)
1518var options = new CSharpCompilationOptions
Compilation\CSharpCompilation.cs (13)
54private readonly CSharpCompilationOptions _options; 214public new CSharpCompilationOptions Options 427private static readonly CSharpCompilationOptions s_defaultOptions = new CSharpCompilationOptions(OutputKind.ConsoleApplication); 428private static readonly CSharpCompilationOptions s_defaultSubmissionOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithReferencesSupersedeLowerVersions(true); 443CSharpCompilationOptions? options = null) 463CSharpCompilationOptions? options = null, 484CSharpCompilationOptions options, 536CSharpCompilationOptions options, 553CSharpCompilationOptions options, 738public CSharpCompilation WithOptions(CSharpCompilationOptions options) 740var oldOptions = this.Options; 2020diagnostics.Add(ErrorCode.ERR_BadCompilationOptionValue, NoLocation.Singleton, nameof(CSharpCompilationOptions.MainTypeName), mainTypeName); 4193return this.WithOptions((CSharpCompilationOptions)options);
Compilation\CSharpDeterministicKeyBuilder.cs (1)
21if (options is not CSharpCompilationOptions csharpOptions)
CSharpCompilationOptions.cs (41)
22public sealed class CSharpCompilationOptions : CompilationOptions, IEquatable<CSharpCompilationOptions> 240private CSharpCompilationOptions(CSharpCompilationOptions other) : this( 280internal CSharpCompilationOptions WithTopLevelBinderFlags(BinderFlags flags) 289public new CSharpCompilationOptions WithOutputKind(OutputKind kind) 299public new CSharpCompilationOptions WithModuleName(string? moduleName) 309public new CSharpCompilationOptions WithScriptClassName(string? name) 319public new CSharpCompilationOptions WithMainTypeName(string? name) 329public new CSharpCompilationOptions WithCryptoKeyContainer(string? name) 339public new CSharpCompilationOptions WithCryptoKeyFile(string? path) 354public new CSharpCompilationOptions WithCryptoPublicKey(ImmutableArray<byte> value) 369public new CSharpCompilationOptions WithDelaySign(bool? value) 379public CSharpCompilationOptions WithUsings(ImmutableArray<string> usings) 389public CSharpCompilationOptions WithUsings(IEnumerable<string>? usings) => 392public CSharpCompilationOptions WithUsings(params string[]? usings) => WithUsings((IEnumerable<string>?)usings); 394public new CSharpCompilationOptions WithOptimizationLevel(OptimizationLevel value) 404public new CSharpCompilationOptions WithOverflowChecks(bool enabled) 414public CSharpCompilationOptions WithNullableContextOptions(NullableContextOptions options) 424public CSharpCompilationOptions WithAllowUnsafe(bool enabled) 435internal CSharpCompilationOptions WithMemorySafetyRules(int version) 448internal CSharpCompilationOptions WithUpdatedMemorySafetyRules(bool enabled = true) 453public new CSharpCompilationOptions WithPlatform(Platform platform) 463public new CSharpCompilationOptions WithPublicSign(bool publicSign) 484public new CSharpCompilationOptions WithGeneralDiagnosticOption(ReportDiagnostic value) 494public new CSharpCompilationOptions WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? values) 509public new CSharpCompilationOptions WithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>>? values) => 512public new CSharpCompilationOptions WithReportSuppressedDiagnostics(bool reportSuppressedDiagnostics) 522public CSharpCompilationOptions WithWarningLevel(int warningLevel) 532public new CSharpCompilationOptions WithConcurrentBuild(bool concurrentBuild) 542public new CSharpCompilationOptions WithDeterministic(bool deterministic) 552internal CSharpCompilationOptions WithCurrentLocalTime(DateTime value) 562internal CSharpCompilationOptions WithDebugPlusMode(bool debugPlusMode) 572public new CSharpCompilationOptions WithMetadataImportOptions(MetadataImportOptions value) 582internal CSharpCompilationOptions WithReferencesSupersedeLowerVersions(bool value) 592public new CSharpCompilationOptions WithXmlReferenceResolver(XmlReferenceResolver? resolver) 602public new CSharpCompilationOptions WithSourceReferenceResolver(SourceReferenceResolver? resolver) 612public new CSharpCompilationOptions WithSyntaxTreeOptionsProvider(SyntaxTreeOptionsProvider? provider) 622public new CSharpCompilationOptions WithMetadataReferenceResolver(MetadataReferenceResolver? resolver) 632public new CSharpCompilationOptions WithAssemblyIdentityComparer(AssemblyIdentityComparer? comparer) 644public new CSharpCompilationOptions WithStrongNameProvider(StrongNameProvider? provider) 762public bool Equals(CSharpCompilationOptions? other) 783return this.Equals(obj as CSharpCompilationOptions);
Errors\MessageProvider.cs (1)
131((CSharpCompilationOptions)options).NullableContextOptions,
Symbols\Metadata\PE\PEMethodSymbol.cs (1)
1551CSharpCompilationOptions.UpdatedMemorySafetyRulesVersion.ToString(CultureInfo.InvariantCulture));
Symbols\Metadata\PE\PEModuleSymbol.cs (1)
777return version == CSharpCompilationOptions.UpdatedMemorySafetyRulesVersion
Symbols\ModuleSymbol.cs (1)
325/// <see cref="CSharpCompilationOptions.UseUpdatedMemorySafetyRules"/>
Symbols\Source\SourceAssemblySymbol.cs (3)
648CSharpCompilationOptions compilationOptions = compilation.Options; 687CSharpCompilationOptions compilationOptions = compilation.Options; 1945CSharpCompilationOptions options = _compilation.Options;
Symbols\Source\SourceModuleSymbol.cs (1)
686var version = ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_Int32), TypedConstantKind.Primitive, CSharpCompilationOptions.UpdatedMemorySafetyRulesVersion));
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (2)
41var compilationOptions = compilation.Options; 46CSharpCompilationOptions compilationOptions,
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
97var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 321(defaultCompleted, options: ((CSharpCompilationOptions)semanticModel.Compilation.Options).NullableContextOptions, cancellationToken));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierDiagnosticAnalyzer.cs (2)
27var options = (CSharpCompilationOptions)compilation.Options;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (2)
39var compilationOptions = (CSharpCompilationOptions?)project.CompilationOptions;
Microsoft.CodeAnalysis.CSharp.Features (10)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (2)
89var compilationOptions = (CSharpCompilationOptions)project.CompilationOptions!;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (2)
41var compilationOptions = compilation.Options; 46CSharpCompilationOptions compilationOptions,
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
97var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 321(defaultCompleted, options: ((CSharpCompilationOptions)semanticModel.Compilation.Options).NullableContextOptions, cancellationToken));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierDiagnosticAnalyzer.cs (2)
27var options = (CSharpCompilationOptions)compilation.Options;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (2)
39var compilationOptions = (CSharpCompilationOptions?)project.CompilationOptions;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (2)
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.FixAllProvider.cs (1)
28if (document.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false })
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.Fixer.cs (1)
32if (context.Document.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false })
Microsoft.CodeAnalysis.CSharp.Scripting (2)
CSharpScriptCompiler.cs (2)
79internal static CSharpCompilationOptions WithTopLevelBinderFlags(CSharpCompilationOptions options)
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Serialization\CSharpOptionsSerializationService.cs (2)
30var csharpOptions = (CSharpCompilationOptions)options;
Workspace\LanguageServices\CSharpCompilationFactoryService.cs (3)
18private static readonly CSharpCompilationOptions s_defaultOptions = new(OutputKind.ConsoleApplication, concurrentBuild: false); 30options: (CSharpCompilationOptions)options ?? s_defaultOptions); 37options: (CSharpCompilationOptions)options,
Microsoft.CodeAnalysis.Rebuild (4)
CSharpCompilationFactory.cs (4)
21public new CSharpCompilationOptions CompilationOptions { get; } 30CSharpCompilationOptions compilationOptions) 57private static (CSharpCompilationOptions, CSharpParseOptions) CreateCSharpCompilationOptions(string assemblyFileName, CompilationOptionsReader optionsReader) 87var compilationOptions = new CSharpCompilationOptions(
Microsoft.DotNet.ApiSymbolExtensions (1)
AssemblySymbolLoader.cs (1)
118CSharpCompilationOptions compilationOptions = new(
Microsoft.Interop.ComInterfaceGenerator (5)
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (1)
31bool unsafeCodeIsEnabled = context.Compilation.Options is CSharpCompilationOptions { AllowUnsafe: true };
ComClassGenerator.cs (1)
32bool unsafeCodeIsEnabled = compilation.Options is CSharpCompilationOptions { AllowUnsafe: true };
ComInterfaceInfo.cs (1)
58if (env.Compilation.Options is not CSharpCompilationOptions { AllowUnsafe: true }) // Unsafe code enabled
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
126bool enableUnsafe = doc.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false }; 225return solution.WithProjectCompilationOptions(project.Id, ((CSharpCompilationOptions)project.CompilationOptions).WithAllowUnsafe(true));
Microsoft.Interop.JavaScript.JSImportGenerator (1)
Analyzers\JSImportExportDiagnosticsAnalyzer.cs (1)
79bool unsafeEnabled = context.Compilation.Options is CSharpCompilationOptions { AllowUnsafe: true };
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (1)
68bool unsafeEnabled = context.Compilation.Options is CSharpCompilationOptions { AllowUnsafe: true };
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
126bool enableUnsafe = doc.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false }; 225return solution.WithProjectCompilationOptions(project.Id, ((CSharpCompilationOptions)project.CompilationOptions).WithAllowUnsafe(true));
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (1)
59if (context.Compilation.Options is not CSharpCompilationOptions { AllowUnsafe: true })
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
211var compilationData = compilation is CSharpCompilation { LanguageVersion: LanguageVersion langVersion, Options: CSharpCompilationOptions compilationOptions }