Skip to content

Request Delegate Generator fails to compile code with CS8601 warning for required non-nullable record parameters #49381

Closed

Description

@martincostello

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Where a Minimal API endpoint uses a type that uses the ValueTask<T> BindAsync(HttpContext) pattern to resolve an [AsParameters] parameter that uses a non-nullable type, the compilation fails with CS8601: Possible null reference assignment.

That might not be quite the pattern of things that trigger this bug, but it's the thing that's "different" about this application's use of Minimal APIs compared to others where I've tested RDG so far.

Expected Behavior

The application compiles and the endpoint behaves as if it were compiled at runtime.

Steps To Reproduce

  1. Clone martincostello/dotnet-minimal-api-integration-testing@b0030a8
  2. Run build.ps1

Exceptions (if any)

No response

.NET Version

8.0.100-preview.6.23330.14

Anything else?

No response

Activity

  1. added
    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
    on Jul 13, 2023
  2. self-assigned this
    on Jul 13, 2023
  3. mitchdenny commented on Jul 13, 2023

    @mitchdenny
    Member

    Thanks Martin - will take a look at this!

  4. martincostello commented on Aug 1, 2023

    @martincostello
    MemberAuthor

    Would #49693 have fixed this?

  5. mitchdenny commented on Aug 1, 2023

    @mitchdenny
    Member

    Possibly but I haven't had a chance to check.

  6. added this to the 8.0-rc2 milestone on Aug 25, 2023
  7. self-assigned this
    on Aug 25, 2023
  8. ghost locked as resolved and limited conversation to collaborators on Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdg

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions