From f3ff72016be911a33cfc53c92c2efe5b1655e201 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 22 Oct 2019 19:50:56 -0700 Subject: [PATCH] Fix document.GetOptionsAsync().WithChangedOption potentially throwing If we both had a document-specific option provided and also tried to change the value, we'd end up throwing an exception. --- src/Workspaces/Core/Portable/Options/OptionServiceFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/Core/Portable/Options/OptionServiceFactory.cs b/src/Workspaces/Core/Portable/Options/OptionServiceFactory.cs index cf6b4735194..0e13ddad27f 100644 --- a/src/Workspaces/Core/Portable/Options/OptionServiceFactory.cs +++ b/src/Workspaces/Core/Portable/Options/OptionServiceFactory.cs @@ -206,7 +206,7 @@ public DocumentSpecificOptionSet(List documentOptions, OptionS public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object? value) { - return new DocumentSpecificOptionSet(_documentOptions, _underlyingOptions, _values.Add(optionAndLanguage, value)); + return new DocumentSpecificOptionSet(_documentOptions, _underlyingOptions, _values.SetItem(optionAndLanguage, value)); } internal override IEnumerable GetChangedOptions(OptionSet optionSet) -- GitLab