Skip to content

Commit

Permalink
fix watson bug
Browse files Browse the repository at this point in the history
oop serialization fails when invalid preprocessor is given to serializer.

either compiler prevent such parse option being created or serializer should be able to create all options that already exist
  • Loading branch information
heejaechang committed Dec 9, 2016
1 parent 2133504 commit 6838177
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ public override ParseOptions ReadParseOptionsFrom(ObjectReader reader, Cancellat
var languageVersion = (LanguageVersion)reader.ReadInt32();
var preprocessorSymbolNames = reader.ReadArray<string>();

var options = new CSharpParseOptions(languageVersion, documentationMode, kind, preprocessorSymbolNames);
return options.WithFeatures(features);
var options = new CSharpParseOptions(languageVersion, documentationMode, kind);

// use WithPreprocessorSymbols instead of constructor to bypass preprocessor validation.
// https://github.com/dotnet/roslyn/issues/15797
return options.WithPreprocessorSymbols(preprocessorSymbolNames)
.WithFeatures(features);
}
}
}

0 comments on commit 6838177

Please sign in to comment.