[1182] Class Never Instantiated, Partial Classes & IoC
I create my winform forms from a central factory into which the forms are registered. Hence I get a lot of Class Never Instantiated warnings thrown up. With the winform form classes being partial I have to comment the warning on each declaration of the partial class, which is a pain. Does it make sense for R# to respect suppression of warnings by commenting (// ReSharper disable ClassNeverInstantiated.Global) on all declarations of a partial class if the suppression exists on one declaration?
Also, would it be possible to register types that should be ignored for non-instantiation warnings? In my case all my forms implement particular interface which I would like to use as the basis for ignoring them in the analysis. This would help when people are using some type of IoC too.
Thanks
Sean
Please sign in to leave a comment.
Hello Sean,
Two options here.
1. Mark your classes with own attribute, mark attribute with MeansImplicitUse
attribute.
2. Adjust project analysis options -- select project, hit F4 or open Properties
toolwindow.
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
IR> I create my winform forms from a central factory into which the
IR> forms are registered. Hence I get a lot of Class Never Instantiated
IR> warnings thrown up. With the winform form classes being partial I
IR> have to comment the warning on each declaration of the partial
IR> class, which is a pain. Does it make
IR> sense for R# to respect suppression of warnings by commenting (//
IR> ReSharper disable ClassNeverInstantiated.Global) on all declarations
IR> of a partial class if the suppression exists on one declaration?
IR> Also, would it be possible to register types that should be ignored
IR> for non-instantiation warnings? This would help when people are
IR> using some type of IoC too.
IR>
IR> Thanks
IR>
IR> Sean
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5233503#5233503
Hello Sean,
1. Mark your classes with own attribute, mark attribute with MeansImplicitUse
attribute
or use predefined UsedImplicitlyAttribute
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
IR> Hello Sean,
IR>
IR> Two options here.
IR>
IR> 2. Adjust project analysis options -- select project, hit F4 or open
IR> Properties
IR> toolwindow.
IR> Sincerely,
IR> Ilya Ryzhenkov
IR> JetBrains, Inc
IR> http://www.jetbrains.com
IR> "Develop with pleasure!"
IR>> I create my winform forms from a central factory into which the
IR>> forms are registered. Hence I get a lot of Class Never
IR>> Instantiated
IR>> warnings thrown up. With the winform form classes being partial I
IR>> have to comment the warning on each declaration of the partial
IR>> class, which is a pain. Does it make
IR>> sense for R# to respect suppression of warnings by commenting (//
IR>> ReSharper disable ClassNeverInstantiated.Global) on all
IR>> declarations
IR>> of a partial class if the suppression exists on one declaration?
IR>> Also, would it be possible to register types that should be ignored
IR>> for non-instantiation warnings? This would help when people are
IR>> using some type of IoC too.
IR>> Thanks
IR>>
IR>> Sean
IR>>
IR>> ---
IR>> Original message URL:
IR>> http://www.jetbrains.net/devnet/message/5233503#5233503
+1
I'd love to be able to tell R# which of my interfaces it should use to ignore classes it shouldn't complain about.
Nice. That'll come in handy once I'm able to move up to 4.5 (waiting on Gallio and a few others to catch up.)
Thanks Ilya - that hits the spot