-
Notifications
You must be signed in to change notification settings - Fork 10k
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
RDG does not support generic types from outer scope #47338
Comments
Thanks for contacting us. We're moving this issue to the |
FWIW, I worked around this in |
I investigated what it would look like to add support for this but ultimately believe that it should be done after #48289 and dotnet/roslyn#68218 are resolved. A current limitation in the interceptors feature is that it does not support intercepting methods with generic type arguments. This gives us three options with how to handle this moving forward:
My preference is the 2nd, 3rd, and 1st options in that order. I'd like to move us away from a world where we ship a generator that has two different interception strategies that we need to support for the lifetime of 8.0. |
Even if dotnet/roslyn#68218 is resolved, I do not think it will address our issue. I explain why in https://github.com/dotnet/roslyn/pull/68218/files#r1220428975, but it mostly boils down to that proposal being about intercepting methods that are already generic rather than introducing generic parameters. And even if we could change the generic arity, we'd then also need to change the handler parameter type from In any case, it doesn't look like any sort of generic interceptor support is planned for .NET 8. Is the plan for preview6 to have RDG skip over delegates with generic types in their signature and emit a warning? |
Moving this to the backlog. For preview7, we fixed this so that static codegen does not happen for these codepaths. We'll need to fix the underlying issues in the interceptors feature for .NET 9. |
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. |
Given the code:
RDG will generate code that fails to compile because
TUser
is undefined. As a short-term mitigation, we can skip generatingMapPost
and similar methods when we see an open generic parameter in the delegate signature. Long term, we can look at flowing the generic parameters through theMap
methods we generate which can then hopefully be inferred.The text was updated successfully, but these errors were encountered: