diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/EditorConfig/EditorConfigStorageLocation`1.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/EditorConfig/EditorConfigStorageLocation`1.cs index d58de2c4ea5db1cf6c2cfc500e0fdda65d07a368..3a9e0d9c0005117510f8d142456736bbf249a023 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/EditorConfig/EditorConfigStorageLocation`1.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/EditorConfig/EditorConfigStorageLocation`1.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; +using Microsoft.CodeAnalysis.CodeStyle; using Roslyn.Utilities; #if CODE_STYLE @@ -104,6 +105,18 @@ string IEditorConfigStorageLocation2.GetEditorConfigString(object? value, Option => $"{KeyName} = {((IEditorConfigStorageLocation2)this).GetEditorConfigStringValue(value, optionSet)}"; string IEditorConfigStorageLocation2.GetEditorConfigStringValue(object? value, OptionSet optionSet) - => GetEditorConfigStringValue((T)value!, optionSet); + { + T typedValue; + if (value is ICodeStyleOption codeStyleOption) + { + typedValue = (T)codeStyleOption.AsCodeStyleOption(); + } + else + { + typedValue = (T)value; + } + + return GetEditorConfigStringValue(typedValue!, optionSet); + } } }