uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

`AsReadOnly<T>` conflicts with `System.Collections.Generic.CollectionExtensions`

Open MartinZikmund opened this issue 1 year ago • 1 comments

What would you like to be added:

Note this extension does not come from Uno Extensions, but from Uno.Core package

When Uno Extensions are included in an app, the Uno.Core AsReadOnly extension will conflict with the .NET built-in one, as Uno Extensions adds global using for Uno.Extensions namespace, so both are included by default when the user uses Uno Extensions, so AsReadOnly is essentially unusable as an extension method.

image

I think it may be just better to keep this one internal only or remove it altogether.

Why is this needed:

Usability

For which Platform:

All

MartinZikmund avatar Mar 29 '24 10:03 MartinZikmund

Uno.Core does not provide this particular extension, it is a sub-package that provides it. If need be, the dependency should be decomposed to avoid using that particular sub-package that provides this extension.

jeromelaban avatar Apr 01 '24 18:04 jeromelaban

@MartinZikmund / @jeromelaban has anything been done about this?

nickrandolph avatar May 07 '24 05:05 nickrandolph

@nickrandolph not yet, not sure if this would be a breaking change that we can safely do?

MartinZikmund avatar May 07 '24 06:05 MartinZikmund

No change has been done for this. The only way to change this is to ensure that uno.extensions does not rely on uno.core, but only the required sub packages.

jeromelaban avatar May 07 '24 12:05 jeromelaban

I think no matter what we do, there has to be a binary break here, but hopefully not major.

Youssef1313 avatar Jun 11 '24 07:06 Youssef1313

https://github.com/unoplatform/Uno.Core/pull/90 will be updating to net7.0 instead of net5.0/net6.0, and AsReadOnly will not be included for net7.0 (it will be kept for netstandard2.0 and uap though)

Youssef1313 avatar Jun 11 '24 07:06 Youssef1313

Uno.Core 4.1.1 is in the dev feed. @nickrandolph it would be interesting to avoid depending on Uno.Core directly, and use the subpackages that are only required by the extensions package that uses it. (list of packages https://github.com/unoplatform/Uno.Core#unocore)

jeromelaban avatar Jun 14 '24 20:06 jeromelaban