2 types derived from Option
Microsoft.Interop.ComInterfaceGenerator (2)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
49public sealed record Bool(bool Value) : Option 54public sealed record String(string Value) : Option
59 references to Option
Microsoft.Interop.ComInterfaceGenerator (59)
Analyzers\AddGeneratedComClassFixer.cs (10)
43protected override Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions) 48protected override string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions) 50bool allowUnsafe = selectedOptions.TryGetValue(Option.AllowUnsafe, out var allowUnsafeOption) && allowUnsafeOption is Option.Bool(true); 57protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic) 59return ImmutableDictionary<string, Option>.Empty; 62protected override ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions) => fixAllOptions;
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (23)
28protected override string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions) 30return selectedOptions.TryGetValue(Option.AllowUnsafe, out Option allowUnsafeOption) && allowUnsafeOption is Option.Bool(true) 35protected override Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions) 37bool mayRequireAdditionalWork = selectedOptions.TryGetValue(Option.MayRequireAdditionalWork, out Option mayRequireAdditionalWorkOption) && mayRequireAdditionalWorkOption is Option.Bool(true); 38bool addStringMarshalling = selectedOptions.TryGetValue(AddStringMarshallingOption, out Option addStringMarshallingOption) && addStringMarshallingOption is Option.Bool(true); 43protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic) 45var optionsBuilder = ImmutableDictionary.CreateBuilder<string, Option>(); 49optionsBuilder.Add(Option.MayRequireAdditionalWork, new Option.Bool(true)); 53optionsBuilder.Add(AddStringMarshallingOption, new Option.Bool(true)); 58protected override ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions) 60ImmutableDictionary<string, Option> combinedOptions = fixAllOptions; 61if (fixAllOptions.TryGetValue(AddStringMarshallingOption, out Option fixAllAddStringMarshallingOption) 62&& fixAllAddStringMarshallingOption is Option.Bool(true) 63&& (!diagnosticOptions.TryGetValue(AddStringMarshallingOption, out Option addStringMarshallingOption) 64|| addStringMarshallingOption is Option.Bool(false)))
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (26)
27protected virtual IEnumerable<ConvertToSourceGeneratedInteropFix> CreateAllFixesForDiagnosticOptions(SyntaxNode node, ImmutableDictionary<string, Option> options) 33protected abstract Func<DocumentEditor, CancellationToken, Task> CreateFixForSelectedOptions(SyntaxNode node, ImmutableDictionary<string, Option> selectedOptions); 35protected abstract string GetDiagnosticTitle(ImmutableDictionary<string, Option> selectedOptions); 59public static ImmutableDictionary<string, Option> ParseOptionsFromEquivalenceKey(string equivalenceKey) 61ImmutableDictionary<string, Option>.Builder options = ImmutableDictionary.CreateBuilder<string, Option>(); 86public static string CreateEquivalenceKeyFromOptions(string baseEquivalenceKey, ImmutableDictionary<string, Option> options) 97protected abstract ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic); 99protected abstract ImmutableDictionary<string, Option> CombineOptions(ImmutableDictionary<string, Option> fixAllOptions, ImmutableDictionary<string, Option> diagnosticOptions); 101private ImmutableDictionary<string, Option> GetOptionsForIndividualFix(ImmutableDictionary<string, Option> fixAllOptions, Diagnostic diagnostic) 135var selectedOptions = fix.SelectedOptions.Add(Option.AllowUnsafe, new Option.Bool(true)); 141Option.CreateEquivalenceKeyFromOptions(BaseEquivalenceKey, selectedOptions)), 157Option.CreateEquivalenceKeyFromOptions(BaseEquivalenceKey, fix.SelectedOptions)), 164protected record struct ConvertToSourceGeneratedInteropFix(Func<DocumentEditor, CancellationToken, Task> ApplyFix, ImmutableDictionary<string, Option> SelectedOptions); 171var options = Option.ParseOptionsFromEquivalenceKey(fixAllContext.CodeActionEquivalenceKey); 174bool addUnsafe = options.TryGetValue(Option.AllowUnsafe, out Option allowUnsafeOption) && allowUnsafeOption is Option.Bool(true); 176bool includeFixesWithAdditionalWork = options.TryGetValue(Option.MayRequireAdditionalWork, out Option includeFixesWithAdditionalWorkOption) && includeFixesWithAdditionalWorkOption is Option.Bool(true); 188bool mayRequireAdditionalWork = diagnostic.Properties.TryGetValue(Option.MayRequireAdditionalWork, out string mayRequireAdditionalWorkString)