Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
b41220a
Optimize qualified name simplification
live1206 Jun 3, 2026
4870164
Handle System member qualified name reduction
live1206 Jun 4, 2026
59eb312
Avoid ambiguous System member pre-reduction
live1206 Jun 4, 2026
5bbd4eb
Revert "Avoid ambiguous System member pre-reduction"
live1206 Jun 4, 2026
47fbfa9
Experiment with manual generated name reduction
live1206 Jun 4, 2026
f25c028
Reduce global aliases in manual name experiment
live1206 Jun 4, 2026
bbf0305
Handle global aliases in cast type arguments
live1206 Jun 4, 2026
8e5c569
Reduce qualified names iteratively
live1206 Jun 4, 2026
d867864
Match generated baselines without Roslyn simplifier
live1206 Jun 4, 2026
6c536ed
Add post-processing benchmark
live1206 Jun 4, 2026
90def0a
Support scaled post-processing benchmark corpora
live1206 Jun 4, 2026
e4019d3
Reduce manual post-processing passes
live1206 Jun 4, 2026
8f6da6a
Profile C# post-processing benchmarks
live1206 Jun 11, 2026
c11ae82
Add provider reference map shadow replacement
live1206 Jun 12, 2026
ff55509
Profile C# post-processing benchmarks
live1206 Jun 11, 2026
f022e78
Add provider reference map shadow replacement
live1206 Jun 12, 2026
f88a64a
Revert "Profile C# post-processing benchmarks"
live1206 Jun 12, 2026
2d57265
Remove hybrid map diagnostics from generator
live1206 Jun 12, 2026
dc145f4
Rename hybrid reference map components
live1206 Jun 12, 2026
0cc3abf
Document hybrid reference map decisions
live1206 Jun 12, 2026
c2abe79
Fix hybrid reference map CI failures
live1206 Jun 12, 2026
a5f8d40
Update provider reference map benchmarks
live1206 Jun 12, 2026
c463995
Track serialization providers in hybrid reference map
live1206 Jun 12, 2026
df00d67
Track serialization providers in benchmark reference map
live1206 Jun 12, 2026
9a1d1a1
Handle model factory subclasses in reference map
live1206 Jun 12, 2026
2917111
Track generated body type references
live1206 Jun 15, 2026
2cda184
Match Roslyn cleanup for body references
live1206 Jun 15, 2026
ce16922
Remove unused serialization providers
live1206 Jun 15, 2026
7a32814
Merge remote-tracking branch 'origin/main' into mtg-hybrid-reference-map
live1206 Jun 15, 2026
5a8248f
Preserve public discriminator subtypes
live1206 Jun 15, 2026
27e121e
Sync benchmark reference map parity fixes
live1206 Jun 15, 2026
43529f3
Use explicit serialization helper dependencies
live1206 Jun 15, 2026
21ecc1a
Use explicit collection result dependencies
live1206 Jun 15, 2026
8bb0d29
Benchmark explicit provider dependencies
live1206 Jun 15, 2026
f3259a4
Use explicit client body dependencies
live1206 Jun 15, 2026
b6e8aad
Track rest client helper dependencies
live1206 Jun 15, 2026
74bd30c
Use explicit client body dependencies
live1206 Jun 15, 2026
8da04b0
Track rest client helper dependencies
live1206 Jun 15, 2026
48885cb
Skip stubbed client body dependencies
live1206 Jun 15, 2026
aa94fa3
Skip stubbed client body dependencies
live1206 Jun 15, 2026
c6539de
Internalize models from final API reachability
live1206 Jun 16, 2026
f676243
Update model root visibility test
live1206 Jun 16, 2026
0a37522
Detect custom model factory providers
live1206 Jun 16, 2026
582fa84
Preserve file header when removing usings
live1206 Jun 16, 2026
74be26d
Limit derived public reachability to discriminators
live1206 Jun 16, 2026
dc6f0f2
Ignore custom roots for derived public reachability
live1206 Jun 16, 2026
7c20ef2
Propagate public discriminator reachability transitively
live1206 Jun 17, 2026
2e4af08
Keep enum serialization helpers reachable
live1206 Jun 17, 2026
8919ffc
Fix XML doc reference spelling
live1206 Jun 17, 2026
4d60b88
perf(http-client-csharp): optimize reference map post-processing
live1206 Jun 19, 2026
26181a8
Merge remote-tracking branch 'origin/main' into mtg-manual-name-reduc…
live1206 Jun 19, 2026
ac2717b
perf(http-client-csharp): optimize reference map post-processing
live1206 Jun 19, 2026
00ca133
fix(http-client-csharp): preserve generated public baseline roots
live1206 Jun 19, 2026
abd3760
fix(http-client-csharp): preserve provider map regen parity
live1206 Jun 21, 2026
620063d
fix(http-client-csharp): preserve dictionary helper body references
live1206 Jun 21, 2026
11ac8ba
Merge remote-tracking branch 'origin/main' into mtg-hybrid-reference-map
live1206 Jun 22, 2026
ce1fef1
fix(http-client-csharp): preserve rest client helper references
live1206 Jun 22, 2026
281af2a
fix(http-client-csharp): limit helper reference fallback
live1206 Jun 22, 2026
12338c4
fix(http-client-csharp): preserve generated internal accessibility
live1206 Jun 22, 2026
9bbb09c
fix(http-client-csharp): preserve last contract roots
live1206 Jun 22, 2026
45d9a27
perf(http-client-csharp): update hybrid reference map benchmark
live1206 Jun 23, 2026
32840a5
perf(http-client-csharp): avoid stale generated roots in benchmark
live1206 Jun 23, 2026
47998b8
perf(http-client-csharp): use current generated roots
live1206 Jun 23, 2026
4117135
fix(http-client-csharp): preserve hybrid reference map parity
live1206 Jun 23, 2026
fa09582
fix(http-client-csharp): keep non-azure union roots
live1206 Jun 23, 2026
d055a32
fix(http-client-csharp): keep enum serialization dependencies
live1206 Jun 24, 2026
0eb6ca5
fix(http-client-csharp): retain custom enum serialization providers
live1206 Jun 24, 2026
b8a5c3a
fix(http-client-csharp): scan serialization provider references
live1206 Jun 24, 2026
912ffe0
fix(http-client-csharp): preserve base-kept dependencies
live1206 Jun 24, 2026
db768fa
perf(http-client-csharp): update hybrid benchmark analyzer
live1206 Jun 24, 2026
57ed559
perf(http-client-csharp): reduce provider reference map overhead
live1206 Jun 24, 2026
88bea57
perf(http-client-csharp): reduce provider reference map analysis cost
live1206 Jun 24, 2026
7b3c0f1
perf(http-client-csharp): scan generated bodies without helper symbol…
live1206 Jun 24, 2026
18b8131
fix(http-client-csharp): preserve generated client helpers
live1206 Jun 24, 2026
b14b1f2
fix(http-client-csharp): preserve generated client helpers
live1206 Jun 24, 2026
4e4f67e
Merge origin/main into mtg-hybrid-reference-map
live1206 Jun 25, 2026
d58bebe
fix(http-client-csharp): add braces for cop check
live1206 Jun 25, 2026
b333b96
Merge latest hybrid reference map changes into benchmark
live1206 Jun 25, 2026
6fe237f
fix(http-client-csharp): preserve provider map signature reachability
live1206 Jun 25, 2026
b3a872f
fix(http-client-csharp): preserve provider map signature reachability
live1206 Jun 25, 2026
f4a1bbb
perf(http-client-csharp): align benchmark provider map fix
live1206 Jun 25, 2026
70bc6ea
fix(http-client-csharp): preserve custom array signature roots
live1206 Jun 25, 2026
a2e86c2
Fix hybrid reference map edge cases
live1206 Jun 25, 2026
4886251
fix(http-client-csharp): keep paging collection constructors public
live1206 Jun 25, 2026
da2ded3
perf(csharp): pre-write internalize provider reference map
live1206 Jun 29, 2026
ee06cf0
Merge branch 'main' into mtg-hybrid-reference-map
live1206 Jun 29, 2026
6e38fe7
fix(csharp): restore model factory methods after generation
live1206 Jun 29, 2026
2348f7c
Merge branch 'mtg-hybrid-reference-map' of https://github.com/live120…
live1206 Jun 29, 2026
98e7c26
fix(csharp): update generated model factory baselines
live1206 Jun 29, 2026
2c17e8c
fix(csharp): skip empty generated model factories
live1206 Jun 29, 2026
aacaf10
docs(csharp): explain provider reference map flow
live1206 Jun 30, 2026
4cb6e59
Fix hybrid reference map public roots
live1206 Jun 30, 2026
5f8792c
Fix hybrid reference map public roots
live1206 Jun 30, 2026
0f8572c
Remove Roslyn from provider reference map
live1206 Jun 30, 2026
95e65cb
docs(csharp): explain provider reference map flow
live1206 Jun 30, 2026
4c7cf5f
perf(csharp): align benchmark public root handling
live1206 Jun 30, 2026
cc036f3
fix(csharp): avoid hardcoded helper keep files
live1206 Jul 1, 2026
2b2c999
refactor(csharp): share provider accessibility candidate logic
live1206 Jul 1, 2026
69cb3d2
fix(csharp): preserve custom request header helpers
live1206 Jul 1, 2026
762a02b
refactor(csharp): use provider markers in reference map
live1206 Jul 1, 2026
dc5b534
refactor(csharp): use typed helper dependencies
live1206 Jul 1, 2026
0a170d3
refactor(csharp): root request header helpers from providers
live1206 Jul 1, 2026
e1a5d68
fix(csharp): avoid hardcoded helper keep files
live1206 Jul 1, 2026
62dff6f
refactor(csharp): share provider accessibility candidate logic
live1206 Jul 1, 2026
f36c8c8
fix(csharp): preserve custom request header helpers
live1206 Jul 1, 2026
66c53ba
refactor(csharp): use provider markers in reference map
live1206 Jul 1, 2026
b7b1eec
refactor(csharp): use typed helper dependencies
live1206 Jul 1, 2026
3ab57ae
refactor(csharp): root request header helpers from providers
live1206 Jul 1, 2026
9832e1a
Optimize C# reference map body analysis
live1206 Jul 1, 2026
79903af
Fix custom-code reference analysis stack overflow
live1206 Jul 1, 2026
eb0b9ac
Merge remote-tracking branch 'origin/main' into mtg-hybrid-reference-map
live1206 Jul 1, 2026
56db6bf
Merge remote-tracking branch 'live1206/mtg-hybrid-reference-map' into…
live1206 Jul 1, 2026
ec68ee3
Update CSharp Spector regen baselines
live1206 Jul 1, 2026
6665e3a
Revert "Update CSharp Spector regen baselines"
live1206 Jul 1, 2026
ee53dab
Fix custom partial model reachability
live1206 Jul 1, 2026
fa098f7
Fix CSharp customization test output path
live1206 Jul 1, 2026
049dd2b
Fix provider reference map state cleanup
live1206 Jul 1, 2026
f702943
Apply latest provider reference map changes to benchmark branch
live1206 Jul 1, 2026
6a19691
Align benchmark provider analyzer with latest PR
live1206 Jul 1, 2026
bf295d1
Fix CSharp provider helper reachability
live1206 Jul 1, 2026
bd0b3c8
fix(http-client-csharp): preserve reference map SDK compatibility
live1206 Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-csharp"
---

Improve C# generator post-processing reference-map parity and performance.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-csharp"
---

Improve generated C# reference-map analysis by deriving generated body references from provider expression trees.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-client-csharp"
---

Preserve generated SDK compatibility when using the optimized C# reference map.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-csharp"
---

Tune hybrid provider reference-map benchmark parity and performance.
1 change: 1 addition & 0 deletions .chronus/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ versionPolicies:
changelog: ["@chronus/github/changelog", { repo: "microsoft/typespec" }]

additionalPackages:
- packages/http-client-csharp
- packages/http-client-python
- packages/http-client-java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ private static bool UseSingletonInstance(InputClient inputClient)

protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs");

protected override bool ShouldWriteTypeXmlDocs => CustomCodeView is null;

protected override TypeSignatureModifiers BuildDeclarationModifiers()
=> _clientProvider.DeclarationModifiers & (TypeSignatureModifiers.Public | TypeSignatureModifiers.Internal | TypeSignatureModifiers.Protected | TypeSignatureModifiers.Private);

protected override string BuildName()
{
if (UseSingletonInstance(_inputClient))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.TypeSpec.Generator.ClientModel.Snippets;
Expand Down Expand Up @@ -52,6 +53,9 @@ protected override MethodProvider[] BuildMethods()
];
}

protected override IReadOnlyList<CSharpType> BuildBodyDependencyTypes()
=> [ErrorResultSnippets.ErrorResultType];

private MethodProvider ProcessHeadAsBoolMessage()
{
MethodSignature signature = GetProcessHeadAsBoolMessageSignature(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private record ApiVersionFields(FieldProvider Field, PropertyProvider? Correspon
private const string ClientSuffix = "Client";
private readonly FormattableString _publicCtorDescription;
private readonly InputClient _inputClient;
protected override bool IsClientProvider => true;
internal InputClient InputClient => _inputClient;
private readonly InputAuth? _inputAuth;
private readonly ParameterProvider _endpointParameter;
Expand Down Expand Up @@ -426,6 +427,42 @@ private IReadOnlyList<ParameterProvider> GetClientParameters()

protected override string BuildName() => _inputClient.IsExactName ? _inputClient.Name : _inputClient.Name.ToIdentifierName();

protected override IReadOnlyList<CSharpType> BuildHelperDependencyTypes()
{
foreach (var method in Methods.OfType<ScmMethodProvider>())
{
if (method.BodyStatements != null)
{
return [new CancellationTokenExtensionsDefinition().Type, new ClientPipelineExtensionsDefinition().Type];
}
}

return [];
}

protected override IReadOnlyList<CSharpType> BuildBodyDependencyTypes()
{
var dependencies = new List<CSharpType>();
foreach (var method in Methods.OfType<ScmMethodProvider>())
{
if (method.BodyStatements == null)
{
continue;
}

if (method.CollectionDefinition != null)
{
dependencies.Add(method.CollectionDefinition.Type);
}

// Service method metadata can mention wire-only request/response models that are not
// emitted in the generated method signature or body. The graph builder and structured
// body scanner capture the generated types that are actually referenced.
}

return dependencies;
}

protected override FieldProvider[] BuildFields()
{
List<FieldProvider> fields = [EndpointField];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal sealed class ClientUriBuilderDefinition : TypeProvider
private readonly FieldProvider _uriBuilderField;
private readonly FieldProvider _pathAndQueryField;
private readonly FieldProvider _pathLengthField;
protected override bool IncludeGeneratedBodyReferences => true;

private PropertyProvider? _uriBuilderProperty;
private PropertyProvider UriBuilderProperty => _uriBuilderProperty ??= new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,22 @@ private bool HasPagingOperationNameCollision(string operationName)
protected override TypeSignatureModifiers BuildDeclarationModifiers()
=> TypeSignatureModifiers.Internal | TypeSignatureModifiers.Partial | TypeSignatureModifiers.Class;

protected override IReadOnlyList<CSharpType> BuildBodyDependencyTypes()
{
var dependencies = new List<CSharpType> { Client.Type, ResponseModelType, NextPagePropertyType };
if (ItemModelType != null)
{
dependencies.Add(ItemModelType);
}

foreach (var field in RequestFields)
{
dependencies.Add(field.Type);
}

return dependencies;
}

protected override FieldProvider[] BuildFields() => [ClientField, .. RequestFields];

protected override CSharpType[] BuildImplements() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public MrwSerializationTypeDefinition(InputModelType inputModel, ModelProvider m

protected override CSharpType? BuildBaseType() => _model.BaseType;

protected override IReadOnlyList<CSharpType> BuildHelperDependencyTypes() => _rawDataField != null || _additionalProperties.Value.Length > 0
? [ChangeTrackingDictionaryType]
: [];

protected override SuppressionStatement[] BuildDisabledFileWarnings()
{
if (_model.CanonicalView.Properties.Any(p => ScmModelProvider.IsFileBinaryContentType(p.Type)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ protected override string BuildRelativeFilePath()
return Path.Combine("src", "Generated", "Models", $"{Name}.Serialization.Multipart.cs");
}

protected override IReadOnlyList<CSharpType> BuildHelperDependencyTypes() => _model.Properties.Any(
prop => prop.WireInfo != null && !prop.WireInfo.IsRequired &&
(prop.Type is { IsCollection: true, IsReadOnlyMemory: false } || prop.Type.IsDictionary))
? [OptionalType]
: [];

protected override SuppressionStatement[] BuildDisabledFileWarnings()
=> [new SuppressionStatement(null, Literal(ScmModelProvider.FileBinaryContentDiagnosticId), ScmModelProvider.ScmEvaluationTypeSuppressionJustification)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,43 @@ protected override FieldProvider[] BuildFields()
return [.. pipelineMessage20xClassifiersFields];
}

protected override IReadOnlyList<CSharpType> BuildHelperDependencyTypes()
{
var dependencies = new List<CSharpType> { new ClientUriBuilderDefinition().Type };
foreach (var serviceMethod in _inputClient.Methods)
{
foreach (var parameter in serviceMethod.Operation.Parameters)
{
if (parameter is not InputHeaderParameter and not InputQueryParameter)
{
continue;
}

var type = ScmCodeModelGenerator.Instance.TypeFactory.CreateCSharpType(parameter.Type);
if (type?.IsDictionary == true)
{
AddDependency(dependencies, ChangeTrackingDictionaryType);
}
else if (type?.IsCollection == true)
{
AddDependency(dependencies, ChangeTrackingListType);
}
}
}

return dependencies;
}

private static void AddDependency(List<CSharpType> dependencies, CSharpType dependency)
{
if (!dependencies.Any(existing =>
existing.Name == dependency.Name &&
existing.Namespace == dependency.Namespace))
{
dependencies.Add(dependency);
}
}

protected override ScmMethodProvider[] BuildMethods()
{
List<ScmMethodProvider> methods = new List<ScmMethodProvider>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -45,6 +46,7 @@ protected override TypeSignatureModifiers BuildDeclarationModifiers()
protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", "Internal", $"{Name}.cs");

protected override string BuildName() => "SerializationFormat";
protected override FormattableString BuildDescription() => $"The serialization format.";

protected override TypeProvider[] BuildSerializationProviders() => [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public static MethodBodyStatement SetContent(this ScopedApi<PipelineRequest> pip
public static MethodBodyStatement SetHeaderDelimited(this HttpRequestApi pipelineRequest, string name, ValueExpression value, ValueExpression delimiter, ValueExpression? format = null)
{
ValueExpression[] parameters = format != null ? [Literal(name), value, delimiter, format] : [Literal(name), value, delimiter];
return pipelineRequest.Property(nameof(PipelineRequest.Headers)).Invoke("SetDelimited", parameters).Terminate();
return pipelineRequest.Property(nameof(PipelineRequest.Headers))
.Invoke("SetDelimited", parameters, typeArguments: null, callAsAsync: false, extensionType: new PipelineRequestHeadersExtensionsDefinition().Type)
.Terminate();
}
}
}
Loading
Loading