Skip to content

Fix check for form parameters that don't need complex binding in RDG #56332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

captainsafia
Copy link
Member

@captainsafia captainsafia commented Jun 19, 2024

Closes #55840.

// Complex form binding is only supported in RDF because it uses shared source with Blazor that requires dynamic analysis
// and codegen. Emit a diagnostic when these are encountered to avoid producing buggy code.
else if (!(SymbolEqualityComparer.Default.Equals(Type, wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_Primitives_StringValues))
|| Type.SpecialType == SpecialType.System_String
|| TryGetParsability(Type, wellKnownTypes, out var _)
|| (IsArray && TryGetParsability(ElementType, wellKnownTypes, out var _))))
{
var location = endpoint.Operation.Syntax.GetLocation();
endpoint.Diagnostics.Add(Diagnostic.Create(DiagnosticDescriptors.UnableToResolveParameterDescriptor, location, symbol.Name));
}

The condition added in the code referenced above needs an additional (IsArray && ElementType.SpecialType == SpecialType.System_String) check since we don't don't generate a parsability method for string types out of TryGetParsability.

@ghost ghost added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Jun 19, 2024
@captainsafia captainsafia added feature-rdg area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions labels Jun 19, 2024
@captainsafia
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@captainsafia captainsafia merged commit 66de09a into main Jun 25, 2024
23 of 26 checks passed
@captainsafia captainsafia deleted the safia/rdg-fix branch June 25, 2024 05:03
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview7 milestone Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-rdg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[9.0-preview.5] Endpoint with nullable parameter no longer generates code with Request Delegate Generator
3 participants