Regression: SyntaxFactory.UsingDirective overload always throws #68761
Labels
Area-Compilers
Bug
Resolution-Fixed
The bug has been fixed and/or the requested behavior has been implemented
Milestone
Version Used:
Version 17.7.0 Preview 2.0
Steps to Reproduce:
Microsoft.CodeAnalysis.CSharp.SyntaxFactory.UsingDirective(SyntaxToken staticKeyword, NameEqualsSyntax alias, NameSyntax name)
with any valid parametersthrows ArgumentException("usingKeyword")
Expected Behavior:
As previously: Construct and pass a valid Token(usingKeyword)
Actual Behavior:
Constructs and passes a
default(SyntaxToken)
which causes the called code to always throwOther details
The bug is here:
roslyn/src/Compilers/CSharp/Portable/Syntax/UsingDirectiveSyntax.cs
Line 38 in d0f4099
It passes through default, to an overload that in the generated syntax factory that throws unless the syntax kind of that parameter is
SyntaxKind.UsingKeyword
The code was added in: c8d3925#diff-95477edd7a2f9bf55ac156fbeb22d71f973b06dc20a7034b373e8c2e8341d6f0
Bug originally reported here: icsharpcode/CodeConverter#1019
Unit test would probably go in
Microsoft.CodeAnalysis.CSharp.UnitTests.SyntaxFactoryTests
and look something like:[jcouv update:] Relates to test plan #56323
The text was updated successfully, but these errors were encountered: