You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting an "Failed to retrieve enumerable item type of System.Collection.ArrayList" exception with inner exception "InvalidOperationException: Sequence contains more than one matching element" at
I was able to fix this problem locally by updating ContextualType.cs replacing the below statement:
var getEnumeratorMethod = Methods.SingleOrDefault(m => m.Name == "GetEnumerator");
with this:
// Ensure class implements IEnumerable since it is possible for a class to contain a GetEnumerator() method
// even if the class doesn't implement IEnumerable.
if (!TypeInfo.ImplementedInterfaces.Any(i => "System.Collections.IEnumerable".Equals(i.FullName, StringComparison.Ordinal)))
{
return null;
}
// If a class defines more than one GetEnumerator() method (System.Collections.ArrayList, eg),
// then find the GetEnumerator() method that takes the least number of input arguments -
// note, the GetEnumerator() method defined by IEnumerable takes zero input arguments.
//
// EndsWith(".GetEnumerator") check is done in case a GetEnumerator() method is namespaced;
// for example: IEnumerator IEnumerable.GetEnumerator().
ContextualMethodInfo getEnumeratorMethod = Methods
.Where(m => m.Name.Equals("GetEnumerator", StringComparison.Ordinal) || m.Name.EndsWith(".GetEnumerator", StringComparison.Ordinal))
.OrderBy(m => m.Parameters.Length)
.FirstOrDefault();
I am getting an "Failed to retrieve enumerable item type of System.Collection.ArrayList" exception with inner exception "InvalidOperationException: Sequence contains more than one matching element" at
Namotion.Reflection/src/Namotion.Reflection/Context/ContextualType.cs
Line 143 in a4354e2
Error occured in NJsonSchema but is thrown in Namotion.Reflection.
Using .Net 8
The text was updated successfully, but these errors were encountered: