diff --git a/src/Features/CSharp/Portable/SimplifyTypeNames/SimplifyTypeNamesCodeFixProvider.cs b/src/Features/CSharp/Portable/SimplifyTypeNames/SimplifyTypeNamesCodeFixProvider.cs index af5475ef1eabab87aecea6ac57949f3307a3ed70..89b18dec0803faa0e98490c382bf915ee4b2b60d 100644 --- a/src/Features/CSharp/Portable/SimplifyTypeNames/SimplifyTypeNamesCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/SimplifyTypeNames/SimplifyTypeNamesCodeFixProvider.cs @@ -43,6 +43,10 @@ protected override string GetTitle(string diagnosticId, string nodeText) protected override SyntaxNode AddSimplificationAnnotationTo(SyntaxNode expressionSyntax) { + // Add the DoNotAllowVarAnnotation annotation. All the code fixer + // does is pass the tagged node to the simplifier. And we do *not* + // ever want the simplifier to produce 'var' in the 'Simplify type + // names' fixer. only the 'Use var' fixer should produce 'var'. var annotatedexpressionSyntax = expressionSyntax.WithAdditionalAnnotations( Simplifier.Annotation, Formatter.Annotation, DoNotAllowVarAnnotation.Annotation);