Inline warning Supression

  • Thread starter Thread starter Sid Price
  • Start date Start date
S

Sid Price

Does VB.NET have any support for inline warning suppression like C#? I am
porting a project from VB.NET 2003 to VB.NET 2005 and I have a bunch of
warnings that after careful examination are benign. I would like to be able
to mark those lines of code so that the warnings to not appear. I do not
want to use a global suppression of the warning check since there may be a
time when adding code that the warning is required to be issued and
addressed.
Thanks,
Sid.
 
Does VB.NET have any support for inline warning suppression like C#? I am
porting a project from VB.NET 2003 to VB.NET 2005 and I have a bunch of
warnings that after careful examination are benign. I would like to be able
to mark those lines of code so that the warnings to not appear. I do not
want to use a global suppression of the warning check since there may be a
time when adding code that the warning is required to be issued and
addressed.
Thanks,
Sid.

Sid,

Other then fixing the warnings - then what you see in the compile
section of the project properties is all you get.
 
Thanks Tom, that is a pity. Being able silence warnings that are benign is
very useful,
Sid.
 
Sid said:
Being able silence warnings that are benign is very useful

But if the condition in question is totally "benign", why is it being
flagged up with a Warning in the first place? Presumably, there has to
be some /reason/ why the compiler is telling you about them.

Just out of interest, which ones /are/ you considering ignoring?

Regards,
Phill W.
 
The compiler only has knowledge of the direct context of the line of code
and the warnings are more often than not warnings that do not (indeed can
not) have real meaning in the context of the complete application using the
code, indeed this is acknowledged in the help file describing these
warnings. As an example consider this warning:

Type of member '<membername>' is not CLS-compliant

And the following comment in the "To correct this error" paragraph:

a.. If your component interfaces only with other .NET Framework components,
or does not interface with any other components, you do not need to change
anything.
The other warnings are very similar in nature. While one appreciates a well
written compiler raising such warnings it is not omnipotent and therefore a
mechanism should be available to suppress specific warnings on an instance
by instance basis rather than the rather more dangerous suppression of the
warning globally.

Sid.
 
Back
Top