Hide parameters with CallerXxxAttribute from interfaces #4950
Replies: 3 comments 5 replies
-
No, there is no way to do this. The consumer is the one that passes these values in. They only know to do this by being able to see and tell that those parameters are there so that it can fill them in at the callsite with teh appropriate values. |
Beta Was this translation helpful? Give feedback.
-
The compiler needs those parameters, so they have to be in the public API. But since the programmer who's calling the method generally doesn't need to know about them, maybe the IDE could do something to hide those parameters in IntelliSense, or at least make them less prominent? |
Beta Was this translation helpful? Give feedback.
-
I will ask this question in Roslyn repo. Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing a SourceGenerator for dependency injection container.
In the generator I am visiting the code tree and recording occurrences of Register and Resolve method calls. Based on analysis of the calls I am generating implementation for these methods.
To match these implementations to actual method calls at runtime I need some form of ID. If I add something like:
it will provide all that I need, but I would have to add it to the public API, defined by interface:
I wonder if these compiler generated parameters could be added to implementation without adding them to the public API? From interface point of view these parameters are irrelevant and only meant for the compiler.
Or, perhaps there is a way to hide these from a consumer?
Beta Was this translation helpful? Give feedback.
All reactions