Skip to content

fix: resolve CSharp wrapper namespace collisions - #8237

Open
Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/csharp-composed-namespace-collision
Open

Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/csharp-composed-namespace-collision

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Fixes #7729.

C# namespace collision handling runs before composed types are converted into wrapper classes. A wrapper created afterward can therefore share its name with a child namespace, producing CS0101. Run the existing collision handling after wrapper creation, before imports are generated, so these wrappers receive the same treatment as ordinary model classes.

Two regressions cover union and intersection wrappers, checking that the original type reference still points at the class after relocation. Both cases fail before the change and pass after it.

Developed with Codex assistance. No live service calls were made.

Validation:

  • The unmodified OpenAPI attachment from [C# Generator] CS0101: Type and child namespace share the same name when schema has nested sub-schema #7729 generates two CS0101 errors before the change. Afterward, the entire generated C# client compiles with .NET 10 and Microsoft.Kiota.Bundle 2.1.2.
  • Full builder suite: 2,350 passed, two existing skips, one failure in GetsGithubFromApisGuruWithExactMatchAsync during an external HTTP download (100-second timeout). This network failure is disclosed; the full suite is not reported as fully green.
  • Generator .NET 10 build and scoped C# formatting verification pass. The generator build emits worktree SourceLink warnings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Two moderate issues remain in wrapper collision merging and suffix-based namespace matching.

Review effort: Lite
Findings: None

What changed in this PR

Fixes C# namespace collisions for composed-type wrapper classes.

Changes:

  • Reorders collision handling after wrapper creation.
  • Adds union and intersection regression tests.
  • Documents the fix in the changelog.
File Description
tests/​Kiota.Builder.Tests/​Refiners/​CSharpLanguageRefinerTests.cs Tests wrapper relocation for unions and intersections.
src/​Kiota.Builder/​Refiners/​CSharpRefiner.cs Reorders refinement and collision handling.
CHANGELOG.md Records the collision fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) your behaviour is disruptive, opening about 30 PRs on the repos in a couple of hours time, most likely code that was AI generated and not tested/reviewed, will only clog our review pipeline. Please stop opening additional pull requests and work on the comments added to existing ones. We have turned on pull requests limits on this repository, and will proceed to blocking you at the organization level if additional pull requests are opened on other repositories before the already opened ones are reviewed and closed/or merged.

Copilot AI review requested due to automatic review settings September 21, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please?

Copilot AI review requested due to automatic review settings September 23, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 23, 2026 14:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 23, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 24, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 01:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor Author

Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please?

Hello, can you please look into my open PR's it's been long they are open.

This branch has not been deployed

No deployments
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.

[C# Generator] CS0101: Type and child namespace share the same name when schema has nested sub-schema

3 participants