question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

exception comparing two string arrays

See original GitHub issue

Trying to compare two string arrays ignoring collection order when the second one starts with a null value.

var compareLogic = new CompareLogic();
compareLogic.Config.IgnoreCollectionOrder = true;
ComparisonResult result = compareLogic.Compare(new[] {"a", "b"}, new[] {null, "a"});

throws

Unhandled exception. System.Exception: Invalid CollectionMatchingSpec.  No such property (null) for type String 
   at KellermanSoftware.CompareNetObjects.IgnoreOrderTypes.IgnoreOrderLogic.GetMatchIndex(ComparisonResult result, List`1 spec, Object currentObject)
   at KellermanSoftware.CompareNetObjects.IgnoreOrderTypes.IgnoreOrderLogic.CompareOutOfOrder(CompareParms parms, Boolean reverseCompare)
   at KellermanSoftware.CompareNetObjects.IgnoreOrderTypes.IgnoreOrderLogic.CompareEnumeratorIgnoreOrder(CompareParms parms, Boolean countsDifferent)
   at KellermanSoftware.CompareNetObjects.TypeComparers.ListComparer.CompareType(CompareParms parms)
   at KellermanSoftware.CompareNetObjects.RootComparer.Compare(CompareParms parms)
   at KellermanSoftware.CompareNetObjects.CompareLogic.Compare(Object expectedObject, Object actualObject)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
GregFinzercommented, Dec 9, 2020

Merged

0reactions
gitjsdr26commented, Dec 9, 2020

Hi, Is this totally fixed ? Because I cannot see the update into the master trunk.

Regards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# compare two string arrays
A very simple approach is with Any from Linq. It is only checking if any part of a line in B is contained...
Read more >
Compare two string arrays for equality in Java
The two string arrays are considered equal if both arrays have the same length and contain the same elements in the same order....
Read more >
Compare Two Arrays in Java
A simple way is to run a loop and compare elements one by one. Java provides a direct method Arrays.equals() to compare two...
Read more >
Check If Two String Arrays are Equivalent (C++, Python & ...
Learn how to check if two string arrays are equivalent or not by using string comparison and the optimal approach in Java, Python,...
Read more >
How to compare two Arrays in Java to check if they are equal
Hello guys, one of the common Programming, the day-to-date task is to compare two arrays in Java and see if they are equal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found