You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure MTG creates and resolves the corresponding input base model provider when a SystemObjectModelProvider wraps a framework type with an existing CLR base type.
SystemObjectModelProvider.BuildBaseType() prefers SystemType.BaseType, so the normal ModelProvider.BuildBaseType() path does not create the declared TypeSpec base model. BuildBaseModelProvider() previously only checked CSharpTypeMap, which could leave the base provider null depending on model creation order.
The fallback now:
Creates the declared input base model when no mapped provider exists.
Verifies that its generated type matches the resolved base type by name.
Registers the resolved CSharpType alias for subsequent lookups.
Added a regression test using ArgumentException and SystemException to cover both automatic system base-provider creation and framework/non-framework CSharpType equivalence.
Summary
Ensure MTG creates and resolves the corresponding input base model provider when a
SystemObjectModelProviderwraps a framework type with an existing CLR base type.SystemObjectModelProvider.BuildBaseType()prefersSystemType.BaseType, so the normalModelProvider.BuildBaseType()path does not create the declared TypeSpec base model.BuildBaseModelProvider()previously only checkedCSharpTypeMap, which could leave the base providernulldepending on model creation order.The fallback now:
CSharpTypealias for subsequent lookups.Added a regression test using
ArgumentExceptionandSystemExceptionto cover both automatic system base-provider creation and framework/non-frameworkCSharpTypeequivalence.Contributes to #10787.
Validation
SystemObjectModelProviderTests: 27 passednpm run test:generatorMgmt-TypeSpec-MultiService