Mark methods as static on auto-generated method
Hello,
I have 5 Web User Controls in my ASP.NET project, on one of them FxCop remarks CA1822 on the Web Form Designer Generated method InitializeComponent().
What might be the reason for that? Could this be related to the fact that I don't use any page event related methods such as Page_Load in this specific control (that's the only difference to the other 4 Web User Controls)?
Thank you,
Andy
[415 byte] By [
andy72] at [2007-12-17]
For this control, there's no access through the 'this' pointer to set any field state, or to call any methods. That means it could be marked as static, except for the fact that it's a designer-emitted method and should not.
In the next version of the framework, this method should be marked as designer-emitted, in which case, FxCop will not fire this rule. In the meantime, we should consider closing down this false positive. Thanks for the problem report.