pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

EnumerableExtensions - DeepEquals is wrong and leads to many issues in PnP Core and Provisioning Engine #1663

Open OliverZeiser opened 6 years ago

OliverZeiser commented 6 years ago

Which PnP repository should you use to report the issue?

Category

[X] Bug

Environment

[X] Office 365 / SharePoint Online [X] SharePoint 2016 [X] SharePoint 2013

If SharePoint on-premises, what's exact CU version: All

Expected or Desired Behavior

The Extension DeepEquals should return a correct info about the compared Objects

Observed Behavior

It does not work in all cases.

Steps to Reproduce

Here is a simple example:

List<int> sourceList = new List<int>();
sourceList.Add(1);

List<int> targetList = new List<int>();
targetList.Add(1);
targetList.Add(2);

So we have obviously two different lists. The Second List contains more elements.... The DeepEquals extensions checks the following: sourceList.Except(targetList).Count()==0

Now in our example the value will actually be 0. Thus stating, the objects would be equal which is obviously wrong...

Here is one Issue that is caused by this wrong extension, but there could be plenty of them because the extension is widely used in PnP Core:

1573

Thanks for your contribution! Sharing is caring.

OliverZeiser commented 6 years ago

I have created a pull request that should at least fix the issue I have showed in my example:

1664