Skip to content

Repair XREF Generator tool - #674

Open
guardrex wants to merge 5 commits into
mainfrom
guardrex/repair-xrefgen-tool
Open

guardrex wants to merge 5 commits into
mainfrom
guardrex/repair-xrefgen-tool

Conversation

@guardrex

@guardrex guardrex commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #673

I'd like to get the XREF gen tool running again. I'm moving it off of CORSPROXY (by tapping api/apibrowser/dotnet/search?api-version=0.2&search={API} and reading the ms.assetid value). CORSPROXY now requires an API key to work. I don't want to leach quota and show a poor security practice by adding the key to the request ($"https://corsproxy.io/?{encodedUrl}&key={KEY}") or use a hosted API for this tool.

The tool is only used by me 🦖 now. It's on the repo because I provided it to MS as a GH Pages demo app for Blazor WebAssembly apps.

These changes make the tool work by directly creating the XREF links using Regex. This isn't the most complete and elegant code, but further updates will need to wait. I'll list and remark on Copilot's last set of suggestions ...

Normalize constructor names to XREF constructor UIDs

Doesn't seem correct from testing here.

Normalize operator signatures to op_* XREF UIDs

True, but it will have to wait. Tracked by #675.

Explicit interface implementations need more than generic-arity replacement.

True, but it will have to wait. Tracked by #675.

Restore escaping for special characters in generated xrefs

Per recent remarks and PRs, the convention shifted to not encoding special characters. I don't think Copilot's concern about markdown rendering is a problem ... at least not here ... I'm not seeing these characters inside of angle brackets causing a markdown rendering problem in VSC.

@guardrex guardrex self-assigned this Oct 6, 2026

This comment was marked as resolved.

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Identifier normalization and escaping still produce invalid or unsafe-to-copy XREF links for supported search results.

No open issues 🎉

4 previously missed issues

In code that hasn't changed since last review

Medium severity Normalize constructor names to XREF constructor UIDs

BlazorWebAssemblyXrefGenerator/​Pages/​Home.razor:134

Constructor display names include a separate constructor member name, for example System.Text.StringBuilder.StringBuilder(). Replacing only the parentheses produces System.Text.StringBuilder.StringBuilder.%23ctor*, but the overload UID is System.Text.StringBuilder.%23ctor*. This also affects constructors with parameters, such as those of HttpClient. Replace the final constructor-name segment together with its parameter list so the generated xrefs resolve.

Medium severity Normalize operator signatures to op_* XREF UIDs

BlazorWebAssemblyXrefGenerator/​Pages/​Home.razor:149

Operator results (ItemType == "Operator") reach this fallback and retain their display signatures, including parameter lists. Those signatures are not XREF UIDs such as System.Decimal.op_Addition*, so the generated references do not resolve. Add operator-specific normalization that maps the displayed operator to its metadata op_* name and removes the parameter list, including handling conversion operators.

Medium severity Normalize explicit interface implementations to XREF UIDs

BlazorWebAssemblyXrefGenerator/​Pages/​Home.razor:157

Explicit interface implementations need more than generic-arity replacement. For example, System.Collections.Generic.List<T>.System.Collections.IList.IsReadOnly becomes System.Collections.Generic.List`1.System.Collections.IList.IsReadOnly, but its UID is System.Collections.Generic.List`1.System#Collections#IList#IsReadOnly. The copied reference therefore does not resolve. Normalize the explicit-interface portion using UID-specific separators and generic-argument notation, then encode it for use in the xref.

Medium severity Restore escaping for special characters in generated xrefs

BlazorWebAssemblyXrefGenerator/​Pages/​Home.razor:158

Restore special-character escaping after constructing the UID. Shared/ApiResult.razor inserts Link directly into the copyable Markdown xrefs, but generic types now contain literal backticks and method overloads contain literal asterisks. These characters can interfere with Markdown parsing instead of producing the intended reference. Apply the previous %60 and %2A replacements after normalization, for every result type.

1 resolved since last review

Review effort: Balanced

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.

2 participants