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
35.46k stars 10.03k forks source link

Avoid `file private` visibility when targeting LangVersion < 11 #46496

Open captainsafia opened 1 year ago

captainsafia commented 1 year ago

The RequestDelegateGenerator currently emits a class with file private visibility to avoid leaking implementation details to user space. This can be problematic if users are targeting a language version below C# 11. To avoid this, we'll want to use internal visibility for those scenarios.

ghost commented 1 year ago

Thanks for contacting us.

We're moving this issue to the .NET 8 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.

eerhardt commented 1 year ago

We should just error out if you aren't using a new enough C#. It is what we do in other source generators - i.e. Regex and Config Binder. ex. https://github.com/dotnet/runtime/pull/83996

mitchdenny commented 1 year ago

Does raise an interesting question. With source generators the language version we rely on when we release 8.0 becomes part of the contract. Moving to newer language features could be considered a breaking change.