Skip to content

SyntaxFactory.ParseCompilationUnit drops parse options #78510

@tmat

Description

@tmat

The ParseOptions returned from SyntaxFactory.ParseCompilationUnit("", options: options).SyntaxTree.Options are the default parse options, not the options passed to the ParseCompilationUnit call.

Workaround:

var unit = SyntaxFactory.CompilationUnit();
unit = unit.SyntaxTree.WithRootAndOptions(unit, options).GetRoot(cancellationToken);

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions