dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.82k stars 9.84k forks source link

Blazor: suspicious CS8601 on nullable delegate/Func/Action component parameters #51296

Open airwedge1 opened 9 months ago

airwedge1 commented 9 months ago

Is there an existing issue for this?

Describe the bug

Re-opening https://github.com/dotnet/aspnetcore/issues/22488 as this is quite annoying.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0.402.

Anything else?

No response

mkArtakMSFT commented 9 months ago

Thanks for raising this. Which .NET SDK version are you seeing this issues with?

ghost commented 9 months ago

Hi @airwedge1. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost commented 9 months ago

Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.

airwedge1 commented 9 months ago

7.0.402. This happens on every .net core version since blazor was created.

ghost commented 9 months ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ImrePyhvelMerit commented 8 months ago

Hey, this is obviously a bug, and annoying at that.

The minimal repro wasa already given in #22488, I can repro this on .Net core 7.0.11:

Repro: For example, take Component1.razor:

<h3>Component 1</h3>

@Content

@code {
    [Parameter]
    public RenderFragment? Content { get; set; }

    [Parameter]
    public Func<int, int>? MyFunc { get; set; }

    [Parameter]
    public (int, int)? MyTuple { get; set; }

}

Which is used into Component2.razor:

<h3>Component 2</h3>

<Component1 Content="ContentNullable"  /* Warning CS8601 */
            MyFunc="MyFuncNullable"    /* Warning CS8601 */
            MyTuple="MyTupleNullable"> /* Ok */
</Component1>

@code {
    public RenderFragment? ContentNullable { get; set; }

    public Func<int, int>? MyFuncNullable { get; set; }

    public (int, int)? MyTupleNullable { get; set; }
}

And you get the CS8601 warning on Content and MyFunc parameters assignment.

ghost commented 6 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost commented 6 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

1cue-jrupp commented 3 months ago

We're also facing this issue with several components that accept nullable Parameters for a good reason. This is quite annoying troughout all .NET Versions including the newest .NET 8 release.