CS0679 / internal virtuals

  • Thread starter Thread starter Rob Agar
  • Start date Start date
R

Rob Agar

hey up everyone,

Is there a workaround for the cause of this warning in .net 1.0? (other than
upgrading to 1.1, which my client doesn't want to do)

warning CS0679: Other languages may permit the internal virtual member
<member>' to be overridden

Failing that, can you disable warnings as you can in c++?

cheers,

Rob
 
Rob,

You can suppress this by using the /nowarn flag with the command line
compiler (and specifying the warnings you want to ignore). I believe there
is something in VS.NET on the project properties page, but I am not sure if
that is for 1.0 as well as 1.1.

Hope this helps.
 
Hi,
In VS .NET 2003 (v 1.1) you can list the warning to suppress in
Project|Propeties->Build->Suppress Secific Warnings. But since I don't have
VS.NET 2002 installed I can only guess that it has the same project setting.

The warning is fired because the CLR v1.0 doesnt support *internal virtual*
event though the compiler emits correct meta data for the assembly the CLR
simply ingnores the *internal* access modifier when combined with *virtual*
and treats those methods as *public virtual* instead.
So, other solution could be to use preporcessor directives for conditional
compilation.
Unfortunately there is no automatic preprocessor symbols, so if you want to
use them you have to decalare one by yourself like

#define CLR10

public class Foo
{
#if CLR10
public
#else
internal
#endif
virtual void Bar()
{
}
}

You can declare CLR10 symbol globaly in the project settings as well.
However the code looks ugly and you have to maintain that symbol by ourself.

So, I believe Nicholas' solution is the way to go.

--
B\rgds
100 [C# MVP]

Nicholas Paldino said:
Rob,

You can suppress this by using the /nowarn flag with the command line
compiler (and specifying the warnings you want to ignore). I believe there
is something in VS.NET on the project properties page, but I am not sure if
that is for 1.0 as well as 1.1.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Rob Agar said:
hey up everyone,

Is there a workaround for the cause of this warning in .net 1.0? (other than
upgrading to 1.1, which my client doesn't want to do)

warning CS0679: Other languages may permit the internal virtual member
<member>' to be overridden

Failing that, can you disable warnings as you can in c++?

cheers,

Rob
 
thanks for the speedy replies and the insight into the cause. I think I'll
live with the warnings for now, as MSVC 2002 doesn't seem to allow for the
suppression of individual warnings.

Rob

Stoitcho Goutsev (100) said:
Hi,
In VS .NET 2003 (v 1.1) you can list the warning to suppress in
Project|Propeties->Build->Suppress Secific Warnings. But since I don't have
VS.NET 2002 installed I can only guess that it has the same project setting.

The warning is fired because the CLR v1.0 doesnt support *internal virtual*
event though the compiler emits correct meta data for the assembly the CLR
simply ingnores the *internal* access modifier when combined with *virtual*
and treats those methods as *public virtual* instead.
So, other solution could be to use preporcessor directives for conditional
compilation.
Unfortunately there is no automatic preprocessor symbols, so if you want to
use them you have to decalare one by yourself like

#define CLR10

public class Foo
{
#if CLR10
public
#else
internal
#endif
virtual void Bar()
{
}
}

You can declare CLR10 symbol globaly in the project settings as well.
However the code looks ugly and you have to maintain that symbol by ourself.

So, I believe Nicholas' solution is the way to go.

--
B\rgds
100 [C# MVP]

message news:[email protected]...
Rob,

You can suppress this by using the /nowarn flag with the command line
compiler (and specifying the warnings you want to ignore). I believe there
is something in VS.NET on the project properties page, but I am not sure if
that is for 1.0 as well as 1.1.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Rob Agar said:
hey up everyone,

Is there a workaround for the cause of this warning in .net 1.0?
(other
than
upgrading to 1.1, which my client doesn't want to do)

warning CS0679: Other languages may permit the internal virtual member
<member>' to be overridden

Failing that, can you disable warnings as you can in c++?

cheers,

Rob
 
Back
Top