3

Duplicate: Why are C# collection-properties not flagged as obsolete when calling properties on them?

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.

Community
  • 1
  • 1
Hinek
  • 9,519
  • 12
  • 52
  • 74
  • Can you givte a code sample and the APi which is obsolete? – JaredPar Mar 26 '09 at 16:45
  • This is a duplicate. http://stackoverflow.com/questions/577132/why-are-c-collection-properties-not-flagged-as-obsolete-when-calling-properties – Jeff Yates Mar 26 '09 at 17:28
  • @JaredPar, I added a code sample, the API is .NET, here the all-time-classic AppSettings vs. ConfigurationManager @Jeff Yates: Thank you, but I'm not sure it is really a duplicate: I just call .NET members, no members of my own code that are obsolete. Plus, I get no "obsolete"-warnings at all ... – Hinek Apr 01 '09 at 13:35

4 Answers4

0

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

David M
  • 71,481
  • 13
  • 158
  • 186
0

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
  • 182,639
  • 35
  • 285
  • 343
0

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

David
  • 34,223
  • 3
  • 62
  • 80
0

Jeff Yates is right, this is a duplicate to Why are C# collection-properties not flagged as obsolete when calling properties on them?

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.

Community
  • 1
  • 1
Hinek
  • 9,519
  • 12
  • 52
  • 74