-
Notifications
You must be signed in to change notification settings - Fork 24
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
SI1103 warning location forces suppression to be all or nothing #163
Comments
If that feels like the wrong place, maybe it would be better to place it on the attribute which registered the type declaring the parameter. |
Neither of those feel like the right place as both could be in a completely separate assembly. |
What about leaving the current behavior as a fallback in the case where it's not all in the same assembly? |
Even then, philosophically it feels the wrong place. Consider the following two modules: public record A(Func<B> b);
public record B();
[Register(typeof(A))]
public class Module1{}
[Register(typeof(B), Scope.SingleInstance)]
public class Module2{} On it's own both of those modules are absolutely fine. It's only when we put the two together in a container that we have a problem. |
I'd see |
I think
Also the complexity of this change is very high. We have to associate every InstanceSource with a unique location and put the diagnostic there. I don't really want to do this for something which I'm just not really sure is the correct solution semantically. I understand the problem that you're trying to solve. I just don't really have a good solution. |
These warnings are all reported on the identifier token of the container class. When it is necessary to suppress one of them, placing
#pragma warning disable SI1103
in the container class file causes all future such warnings to be suppressed.A solution could be to report the warning on the syntax
Func<Bar>
which triggered the warning. Willing to implement.Could this rationale apply to other warnings?
The text was updated successfully, but these errors were encountered: