-
Notifications
You must be signed in to change notification settings - Fork 413
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
Conflict with Microsoft.IdentityModel.Tokens.CollectionUtilities.IsNullOrEmpty extension #1722
Comments
@CodeBlanch rats. It should have been internal, that is a mistake. |
@brentschmaltz Not exactly. Let's say my extension is: namespace Company.Extensions
{
public static class EnumerableExtensions
{
public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable) { ... }
}
} I had some code like... using Microsoft.IdentityModel.Tokens;
using Company.Extensions;
public class SomeClass
{
public TokenValidationParameters BuildValidationParameters(ValidationOptions options)
{
return new TokenValidationParameters
{
ValidAudiences = options.ValidAudiences.IsNullOrEmpty()
? options.DefaultValidAudiences
: options.ValidAudiences;
};
}
} In that case, because both Fix is just to qualify it like... using Microsoft.IdentityModel.Tokens;
using Company.Extensions;
public class SomeClass
{
public TokenValidationParameters BuildValidationParameters(ValidationOptions options)
{
return new TokenValidationParameters
{
ValidAudiences = EnumerableExtensions.IsNullOrEmpty(options.ValidAudiences)
? options.DefaultValidAudiences
: options.ValidAudiences;
};
}
} Easy enough workaround, no big deal to keep it like that. |
Too bad this wasn't addressed when you could. We're now seeing conflicts as well. Why can't you make this internal? |
@brentschmaltz can you please reconsider leaving this public? We just wasted a couple days hunting down build issues in Power BI which ended up being related to accidental use of this extension method. Your assembly really should not be exposing an extremely generic and easily misused extension like this. Because of the signature, this extension method even shows up on standard strings where it really should not be used in place of the static string.IsNullOrEmpty method. Components can introduce breaking changes with a major version bump. I don't think leaving this public is the right tradeoff - better to rip off the band-aid and prevent future misuse of this extremely broad extension method. |
@aaron-meyers i reopened so we can reconsider. |
Personally I've hoped it would be "internalized" for v7 :( |
@brockallen i agree, would have been nice to fix this before our 7 release. |
Will this be a part of v8 ? |
Closing as there is an easy workaround (fully qualify conflicting methods), and customers are used to using this convenience method now. cc: @eerhardt FYI |
Please consider reopening it. |
@jmprieur I agree with @Dreamescaper this extension method is PITA. So please in next major version remove this
No, responsibility of this package is not to provide this type of extension methods. So it simply shouldnt be there because for others(us included) it causes other inconveniences. |
@brentschmaltz |
…OrEmpty` (#2471) ## Why make this change? - Closes #2469 - There is a namespace collision for the `IsNullOrEmpty` method in the `MsSqlQueryBuilder` class between String and CollectionUtils class. ## What is this change? - `MsSqlQueryBuilder` class had a check in the `Build` method where it was using `IsNullOrEmpty` for Strings but it was refrencing CollectionUtils Class instead - Removed `Collection.Utilities` class from Cli and renamed it in the Core project to `EnumerableUtilities` to avoid any future namespace collision. - Also updated all the references of `IsNullOrEmpty` ## How was this tested? - [x] manual tests - [x] current existing tests Notes: Work Around shared here: AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#1722 --------- Co-authored-by: Aaron Burtle <aaronburtle@microsoft.com> Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
…OrEmpty` (#2471) ## Why make this change? - Closes #2469 - There is a namespace collision for the `IsNullOrEmpty` method in the `MsSqlQueryBuilder` class between String and CollectionUtils class. ## What is this change? - `MsSqlQueryBuilder` class had a check in the `Build` method where it was using `IsNullOrEmpty` for Strings but it was refrencing CollectionUtils Class instead - Removed `Collection.Utilities` class from Cli and renamed it in the Core project to `EnumerableUtilities` to avoid any future namespace collision. - Also updated all the references of `IsNullOrEmpty` ## How was this tested? - [x] manual tests - [x] current existing tests Notes: Work Around shared here: AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#1722 --------- Co-authored-by: Aaron Burtle <aaronburtle@microsoft.com> Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
This
Microsoft.IdentityModel.Tokens.CollectionUtilities.IsNullOrEmpty
extension introduced in the latest version broke one of the codebases I work on because there is a similar extension already present. It was easy enough to fully quality things where we had issues but I thought I would raise the question here: ShouldCollectionUtilities
beinternal
to Microsoft.IdentityModel.Tokens?The text was updated successfully, but these errors were encountered: