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

Inconsistent namespaces #55824

Open
1 task done
PonchoPowers opened this issue May 21, 2024 · 2 comments
Open
1 task done

Inconsistent namespaces #55824

PonchoPowers opened this issue May 21, 2024 · 2 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@PonchoPowers
Copy link
Contributor

PonchoPowers commented May 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

This happens in quite a few places, some namespaces have the word Abstractions in them, but then others don't.

Microsoft.Extensions.Caching.Abstractions
Contains classes with the namespace:
Microsoft.Extensions.Caching.X (no Abstractions in namespace)

Microsoft.Extensions.Configuration.Abstractions
Contains classes with the namespace:
Microsoft.Extensions.Configuration.X (no Abstractions in namespace)

Microsoft.Extensions.Logging.Abstractions
Contains classes with the namespace:
Microsoft.Extensions.Logging.Abstractions

Microsoft.Extensions.FileSystemGlobbing.Abstractions
Contains classes with the namespace:
Microsoft.Extensions.Logging.Abstractions

I think there are 8 namespaces that include the word Abstractions in them.

Is there a reason for this, and if not, is it correct to include the word Abstractions or not?

Also, if Abstractions should be included, where should the positioning of the word be, at the end of the namespace, or at the end of the project name, ie:

Microsoft.Extensions.Logging.AnotherProvider.Abstractions
- or -
Microsoft.Extensions.Logging.Abstractions.AnotherProvider

Can you provide some guidance on this please?

Expected Behavior

My personal view is that abstractions should have namespaces with either the word Abstractions in them or not.

I also think either an analyzer rule should be created to avoid this from happening or have some other way to protect against inconsistent namespace rules.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label May 21, 2024
@amcasey
Copy link
Member

amcasey commented May 31, 2024

@halter73 or @BrennanConroy may have some historical context.

@PonchoPowers
Copy link
Contributor Author

Is it not caused by Visual Studio when you create a project, if you create a project with the name .Extensions in it then the namespaces will also have this in it, this would be my gut feeling, and if so then I guess it is incorrect and maybe somehow slipped into the production code. If this is the case then it would be good to have some sort of protection from this happening again, may an analyzer or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

2 participants