For the life of me, I cannot figure out why this line of code:
var literalExpressionSyntax =
Syntax.LiteralExpression(SyntaxKind.CharacterLiteralExpression);
throws an ArgumentOutOfRangeException
under Roslyn CTP3.
The reason the second parameter is optional is that the text is implied for some SyntaxKind
values. For example, if you pass SyntaxKind.TrueLiteral
for the first argument, then you can omit the second one. However, when there is no reasonable default for the second parameter based on the first parameter, we throw the ArgumentOutOfRangeException
.
In your example, you can create the expression with:
Syntax.LiteralExpression(SyntaxKind.CharacterLiteralExpression, Syntax.Literal('a'))
Shouldn't you supply the second argument, which is the actual literal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With