Repository: dotnet/roslyn
File: src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs (C#)

Code before:
            var compUnit = SyntaxFactory.ParseCompilationUnit("", options: parseOptions);
            Assert.Same(parseOptions, compUnit.SyntaxTree.Options);

            var expr = SyntaxFactory.ParseExpression("", options: parseOptions);
            Assert.Same(parseOptions, expr.SyntaxTree.Options);

            var memberDecl = SyntaxFactory.ParseMemberDeclaration("public", options: parseOptions);
            Assert.Same(parseOptions, memberDecl.SyntaxTree.Options);

            var paramList = SyntaxFactory.ParseParameterList("", options: parseOptions);
            Assert.Same(parseOptions, paramList.SyntaxTree.Options);

            var statement = SyntaxFactory.ParseStatement("", options: parseOptions);
            Assert.Same(parseOptions, statement.SyntaxTree.Options);

            var typeName = SyntaxFactory.ParseTypeName("", options: parseOptions);
            Assert.Same(parseOptions, typeName.SyntaxTree.Options);
        }

        [Fact]
        public void Identifier_Null_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => SyntaxFactory.Identifier(null));
        }

        [Fact]
        public void Identifier_WithTrivia_NullText_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => 
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), null, SyntaxFactory.TriviaList()));
        }

        [Fact]
        public void Identifier_WithContextualKind_NullText_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => 
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, null, "value", SyntaxFactory.TriviaList()));
        }

        [Fact]
        public void Identifier_WithContextualKind_NullValueText_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => 
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, "text", null, SyntaxFactory.TriviaList()));
        }

        [Fact]
        public void VerbatimIdentifier_NullText_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => 
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), null, "value", SyntaxFactory.TriviaList()));

Review comment (suggestion):
@copilot These should have `[WorkItem("...")]` attributes identifying the github issue that prompted making these changes.

Code after:
            var compUnit = SyntaxFactory.ParseCompilationUnit("", options: parseOptions);
            Assert.Same(parseOptions, compUnit.SyntaxTree.Options);

            var expr = SyntaxFactory.ParseExpression("", options: parseOptions);
            Assert.Same(parseOptions, expr.SyntaxTree.Options);

            var memberDecl = SyntaxFactory.ParseMemberDeclaration("public", options: parseOptions);
            Assert.Same(parseOptions, memberDecl.SyntaxTree.Options);

            var paramList = SyntaxFactory.ParseParameterList("", options: parseOptions);
            Assert.Same(parseOptions, paramList.SyntaxTree.Options);

            var statement = SyntaxFactory.ParseStatement("", options: parseOptions);
            Assert.Same(parseOptions, statement.SyntaxTree.Options);

            var typeName = SyntaxFactory.ParseTypeName("", options: parseOptions);
            Assert.Same(parseOptions, typeName.SyntaxTree.Options);
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/17637")]
        public void Identifier_Null_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => SyntaxFactory.Identifier(text: null));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), text: null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, text: null, valueText: "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, text: "text", valueText: null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), text: null, valueText: "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), text: "text", valueText: null, SyntaxFactory.TriviaList()));
        }
    }
}