[http-client-csharp] Add repro for model factory namespace loss by live1206 · Pull Request #11848 · microsoft/typespec · GitHub
Skip to content

[http-client-csharp] Add repro for model factory namespace loss - #11848

Draft
Wei Hu (live1206) wants to merge 2 commits into
microsoft:mainfrom
live1206:issue-11846-model-factory-repro
Draft

[http-client-csharp] Add repro for model factory namespace loss#11848
Wei Hu (live1206) wants to merge 2 commits into
microsoft:mainfrom
live1206:issue-11846-model-factory-repro

Conversation

@live1206

Copy link
Copy Markdown
Contributor

Summary

  • add a focused reproduction for the model-factory namespace loss described in [http-client-csharp] Model factory loses namespaces for custom constructor parameter types #11846
  • suppress the generated full constructor and replace it with a custom internal constructor whose parameters reference generated model types
  • include a distinct custom model-factory overload so the generated overload remains present
  • assert that generated model parameter namespaces are preserved and malformed using ; and global::. output is not emitted

This PR intentionally contains only the failing reproduction and remains a draft until the generator fix is added.

Validation

  • dotnet test packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Microsoft.TypeSpec.Generator.Tests.csproj --filter "FullyQualifiedName~CustomFullConstructorFactoryMethodRetainsGeneratedModelParameterNamespaces" --no-restore — fails as expected because the generated model factory contains using ; and global::. type references

Reproduces #11846

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Sep 3, 2026
…actory-repro

# Conflicts:
#	packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelFactories/ModelFactoriesCustomizationTests.cs
@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant