Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Obsolete warnings to all System.Data.SqlClient public APIs #158

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

cheenamalhotra
Copy link
Member

@cheenamalhotra cheenamalhotra commented Nov 6, 2024

Addresses #125

Updated:

  • Only Public APIs are marked Obsolete, warning CS0618 disabled across projects.
  • PNSE assemblies are also updated with Obsolete attributes.

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While working on public APIs, the usage of those in internal classes also incurred CS0618 warnings for which I marked "SqlClient specific" internal APIs are obsolete too. Let me know for any concerns.

Isn't all System.Data.SqlClient supposed to be marked as obsolete? I was unable to understand the pattern of adding the Obsolete attribute to some specific APIs but not others. Why not add it at the assembly level?

Since we don't have .NET Standard functional asset, skipping check for that, would appreciate any feedback.

Can you please elaborate on that?

<TargetFrameworks>$(NetCurrent)-windows;$(NetCurrent)-unix;$(NetCurrent);$(NetMinimum)-windows;$(NetMinimum)-unix;$(NetMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>

@cheenamalhotra
Copy link
Member Author

cheenamalhotra commented Nov 7, 2024

I looked up ObsoleteAttribute documentation and couldn't find any other way to mark APIS obsolete. Based on remarks I don't see they support at Assembly level.

Let me know if you have a way to may it work.

Regarding .Net Standard 2.0 target, yes we target the same but it's a PNSE assembly in the new package which doesn't compile these classes but the notsupported.cs file. I wasn't sure if we need to add the Obsolete attributes there.

@ViktorHofer
Copy link
Member

ViktorHofer commented Nov 7, 2024

Yes, the .notsupported.cs file needs the Obsolete attributes as well. As Carlos mentioned, internal API doesn't need to be annotated with the attribute.

I looked up ObsoleteAttribute documentation and couldn't find any other way to mark APIS obsolete. Based on remarks I don't see they support at Assembly level.

Correct, the ObsoleteAttribute can't be put on assemblies or modules.

@carlossanlop
Copy link
Member

carlossanlop commented Nov 7, 2024

Correct, the ObsoleteAttribute can't be put on assemblies or modules.

Can't it be placed on top of a namespace?

Edit: I checked, apparently it cannot be done. Oh well.

@cheenamalhotra cheenamalhotra changed the title Add Obsolete warnings to all System.Data.SqlClient APIs Add Obsolete warnings to all System.Data.SqlClient public APIs Nov 7, 2024
Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I see now all public APIs have the attribute.
Thanks for removing the xmls.
It's a bummer that we can't localize the obsolete string.
Let's wait for any comments from @ViktorHofer , if any.

@ViktorHofer ViktorHofer merged commit 5a038ad into main Nov 8, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants