Use hybrid C# reference map for post-processing#10976
Open
live1206 wants to merge 52 commits into
Open
Conversation
commit: |
Contributor
|
No changes needing a change description found. |
This reverts commit ff55509.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
| public static void Analyze(IReadOnlyList<TypeProvider> providers, Project project) | ||
| { | ||
| var generatedProviders = GetGeneratedProviders(providers); |
Member
There was a problem hiding this comment.
I am not sure why we have to exclude the custom code - we might produce incorrect result if custom code is not considered.
Also I think we should do it for CanonicalView of each provider.
Contributor
Author
There was a problem hiding this comment.
explained in PR description, and feel free to continue with this further improvement, I will not cover this part in current PR
Handle duplicate generated providers, avoid namespace-blind API baseline roots, and keep collection result constructors internal so implementation-only REST clients are not publicized. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the C# generator's Roslyn-heavy generated-code reference-map construction with a provider/hybrid reference map while preserving generated-output correctness.
Why custom code still uses Roslyn
Generated code has provider metadata for signatures, body dependencies, serialization helpers, and known generated source patterns, so it can avoid building a full Roslyn reference map. Custom/shared code is arbitrary user C#: it can reference generated types through signatures, inheritance, generics, arrays, object creation, static members, extension methods, XML docs, or handwritten helper flows that provider metadata cannot see. This PR therefore keeps Roslyn semantic analysis for custom-code roots/references and uses the faster provider graph for generated-code reachability.
Latest benchmark data
Latest generator PR head:
48862512. Benchmark PR: #10885 (f4a1bbbec). Artifacts:/tmp/typespec-review-fix-bench-20260625-0637.Azure SDK local project-reference benchmark
Measured Azure SDK for .NET management-plane regeneration using the same local project-reference setup in both runs:
/workspaces/azure-sdk-for-netwas wired to the sibling/workspaces/typespeccheckout via .NET project references, and only the TypeSpec checkout changed betweenmainand this PR branch.Validation