Skip to content

Add [StringSyntax(Json)] to string parameters that accept JSON - #66358

Merged
ilonatommy merged 3 commits into
dotnet:mainfrom
KitKeen:add-stringsyntax-json
Jun 25, 2026
Merged

ilonatommy merged 3 commits into
dotnet:mainfrom
KitKeen:add-stringsyntax-json

Conversation

@KitKeen

@KitKeen KitKeen commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Add [StringSyntax(Json)] to Blazor/Identity params accepting raw JSON.

Description

Annotates string parameters that accept JSON payloads with
[StringSyntax(StringSyntaxAttribute.Json)] so IDEs and analyzers
provide JSON syntax highlighting and validation. No runtime behavior change.

Affected APIs:

  • SignInManager.PerformPasskeyAttestationAsync(credentialJson)
  • SignInManager.PerformPasskeyAssertionAsync(credentialJson)
  • SignInManager.PasskeySignInAsync(credentialJson)
  • DefaultWebAssemblyJSRuntime.EndInvokeJS(argsJson)
  • DefaultWebAssemblyJSRuntime.BeginInvokeDotNet(argsJson)
  • DefaultWebAssemblyJSRuntime.UpdateRootComponentsCore(operationsJson)
  • ComponentHub.BeginInvokeDotNetFromJS(argsJson)
  • CircuitHost.BeginInvokeDotNetFromJS(argsJson)

Follows the existing pattern used in NavigationManager,
IInternalWebJSInProcessRuntime, and WebViewManager in this repo,
and mirrors JamesNK's previous PR #45146 that added the same
attribute to other call sites.

  • Contributor Guide and Code of Conduct read
  • Inline docs unchanged (attribute is inert at runtime)
  • No tests needed (compile-time analyzer hint only, no behavior)

Contributes to #44535

Adds StringSyntaxAttribute with Json identifier to parameters in
SignInManager (credentialJson), DefaultWebAssemblyJSRuntime (argsJson,
operationsJson), ComponentHub (argsJson), and CircuitHost (argsJson).

Closes dotnet#44535
@KitKeen
KitKeen requested a review from a team as a code owner April 18, 2026 09:46
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Apr 18, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 18, 2026
@KitKeen

KitKeen commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@KitKeen

KitKeen commented Apr 19, 2026

Copy link
Copy Markdown
Contributor Author

/azp run aspnetcore-ci

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 66358 in repo dotnet/aspnetcore

@KitKeen

KitKeen commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the approval, @Youssef1313! CI is green and mergeStateStatus is clean — is there anything else needed from me, or can someone with merge rights take this over the line?

@Youssef1313

Copy link
Copy Markdown
Member

@ilonatommy @dariatiurina for a second review please

@KitKeen

KitKeen commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@ilonatommy @dariatiurina friendly nudge on the second review @Youssef1313 requested - the PR has been approved + clean since April 23. Happy to address any further feedback. Thanks!

@Youssef1313
Youssef1313 requested a review from oroztocil May 21, 2026 08:14

@ilonatommy ilonatommy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

arguments from EndInvokeJS is also receiving JSON payload

public static void EndInvokeJS(JSRuntime jsRuntime, string arguments)

@KitKeen

KitKeen commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, @ilonatommy — annotated arguments in EndInvokeJS(JSRuntime, string) at DotNetDispatcher.cs:306 with [StringSyntax(StringSyntaxAttribute.Json)] in dd606be. Let me know if there are other spots I missed.

@KitKeen

KitKeen commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Both reviews are in now (thanks @Youssef1313 and @ilonatommy) and the PR has been approved and clean since May 21. The two red checks (Build Analysis and aspnetcore-template-tests-pr) look like unrelated infra flakes - this change only adds [StringSyntax(Json)] attributes and doesn't touch templates or build tooling. Could someone with merge rights take it over the line? Happy to rebase or re-run CI if that helps.

@ilonatommy
ilonatommy enabled auto-merge (squash) June 25, 2026 09:52
@ilonatommy

Copy link
Copy Markdown
Member

/ba-g failures in template tests are not connected

@ilonatommy
ilonatommy merged commit 70c07fa into dotnet:main Jun 25, 2026
24 of 25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants