views:

520

answers:

4

Duplicate: http://stackoverflow.com/questions/577132/why-are-c-collection-properties-not-flagged-as-obsolete-when-calling-properties

I just migrated a .NET 1.1 project to .NET 2.0 using Visual Studio 2008. I know that there are references to obsolete methods in the project.

But Visual Studio does not show "obsolete"-warnings after building. The build succeeds and shows only 3 warnings from members that are assigned a value that is never used. When I remove these members there are no warnings at all.

I NEED THESE "OBSOLETE"-WARNINGS

The Warning level is 4 (maximum), Warnings are enabled.

Just one sample:

protected internal DataConnector()
{
    _connectionString = ConfigurationSettings.AppSettings["ProductConnectionString"];
}

All references that should result in an "obsolete"-warning are to members of classes of the .NET Framework.

A: 

Is the code calling the obsolete method(s) itself flagged as obsolete?

David M
No, it has no ObsoleteAttribute.
Hinek
A: 

Just taking a shot in the dark here, but is the usage of an obsolete member taking place in a project that you're REFERENCING, and when you're building it isn't actually rebuilding that project? If that's a possibility, I would try manually building the project where the usage is taking place, or just rebuilding the entire solution.

Adam Robinson
Already tried rebulding the Solution or just the Project, no change
Hinek
A: 

Make sure you are doing a full build on the project, not just an incremental build.

David
How do I do this? I used "Rebuild", is that enough?
Hinek
A: 

Jeff Yates is right, this is a duplicate to http://stackoverflow.com/questions/577132/why-are-c-collection-properties-not-flagged-as-obsolete-when-calling-properties

It is a bug in the C# 3.5 compiler reported here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=417159

I checked it: copied the csc.exe commandline from the output window to a cmd-console. When I change the directory to the .NET 2.0 directory (using C# 2.0 compiler), it shows the warnings. Microsoft knows this bug and fixed it in C# 4.0 but will not fix it in the 3.5 version.

Hinek
Not on my 3.5sp1! I still get the warnings.
leppie
"... fixed it in C# 4.0 but will NOT fix it in the 3.5 version"
Hinek