From 92c928447ac7412d67b85dceab47fa13327acc5b Mon Sep 17 00:00:00 2001 From: GrahamTheCoder Date: Tue, 14 Nov 2017 15:57:05 +0000 Subject: [PATCH] Add parentheses required in C# for empty arg list --- RefactoringEssentials/CSharp/Converter/NodesVisitor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RefactoringEssentials/CSharp/Converter/NodesVisitor.cs b/RefactoringEssentials/CSharp/Converter/NodesVisitor.cs index 5134eab..497892a 100644 --- a/RefactoringEssentials/CSharp/Converter/NodesVisitor.cs +++ b/RefactoringEssentials/CSharp/Converter/NodesVisitor.cs @@ -885,9 +885,10 @@ namespace RefactoringEssentials.CSharp.Converter public override CSharpSyntaxNode VisitObjectCreationExpression(VBSyntax.ObjectCreationExpressionSyntax node) { + var argumentListSyntax = node.ArgumentList ?? VBasic.SyntaxFactory.ArgumentList(); //VB can omit empty arg lists entirely return SyntaxFactory.ObjectCreationExpression( (TypeSyntax)node.Type.Accept(this), - (ArgumentListSyntax)node.ArgumentList?.Accept(this), + (ArgumentListSyntax)argumentListSyntax.Accept(this), (InitializerExpressionSyntax)node.Initializer?.Accept(this) ); }