Skip to content

Neokil fix/csharp test type name collision - #24522

Draft
wing328 wants to merge 6 commits into
masterfrom
Neokil-fix/csharp-test-type-name-collision
Draft

Neokil fix/csharp test type name collision#24522
wing328 wants to merge 6 commits into
masterfrom
Neokil-fix/csharp-test-type-name-collision

Conversation

@wing328

@wing328 wing328 commented Jul 30, 2026

Copy link
Copy Markdown
Member

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Qualifies model types in generated C# Generic Host API tests to avoid collisions with .NET types. Uses fully qualified model names in Assert.IsType checks so tests compile when model names match framework types.

  • Bug Fixes
    • In csharp/libraries/generichost/api_test.mustache, Assert.IsType<> now prefixes model return types with {{packageName}}.{{modelPackage}} (only when isModel) to disambiguate.
    • Regenerated C# Generic Host samples across latest, net8, net10, net4.7, and net4.8 to apply the change.

Written for commit f07e31e. Summary will update on new commits.

Review in cubic

Neokil and others added 6 commits March 27, 2026 11:14
…tandard library name collisions

When a model class shares a name with a .NET standard library type (e.g.
`Attributes`), the generated `Assert.IsType<Attributes>(model)` call is
ambiguous and fails to compile. Use the fully-qualified type name
`{{packageName}}.{{modelPackage}}.{{{.}}}` for model return types so the
generated test code is unambiguous regardless of model naming.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…generichost/api_test.mustache

Co-authored-by: Christopher Molin <28791817+Chrimle@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants