From 8e0616d781e7ad880f0f052bf1de6c8dd9fe8108 Mon Sep 17 00:00:00 2001 From: JohanLarsson Date: Sat, 16 May 2020 10:25:38 +0200 Subject: [PATCH] Create using directive using API instead of parse. Shot in the dark for #228 --- ReflectionAnalyzers/Codefixes/BindingFlagsFix.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ReflectionAnalyzers/Codefixes/BindingFlagsFix.cs b/ReflectionAnalyzers/Codefixes/BindingFlagsFix.cs index 7064c9bd..4b044ba1 100644 --- a/ReflectionAnalyzers/Codefixes/BindingFlagsFix.cs +++ b/ReflectionAnalyzers/Codefixes/BindingFlagsFix.cs @@ -1,4 +1,4 @@ -namespace ReflectionAnalyzers +namespace ReflectionAnalyzers { using System.Collections.Immutable; using System.Composition; @@ -16,7 +16,11 @@ namespace ReflectionAnalyzers [Shared] internal class BindingFlagsFix : DocumentEditorCodeFixProvider { - private static readonly UsingDirectiveSyntax SystemReflection = SyntaxFactory.UsingDirective(SyntaxFactory.ParseName("System.Reflection")); + private static readonly UsingDirectiveSyntax SystemReflection = SyntaxFactory.UsingDirective( + SyntaxFactory.QualifiedName( + SyntaxFactory.IdentifierName("System"), + SyntaxFactory.IdentifierName("Reflection"))); + private static readonly ArgumentSyntax NullArgument = SyntaxFactory.Argument(SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression)) .WithAdditionalAnnotations(Formatter.Annotation);