simple-odata-client / Simple.OData.Client

MIT License
331 stars 197 forks source link

InvalidOperationException thrown when reading entities #537

Open chancie86 opened 6 years ago

chancie86 commented 6 years ago

When pointing the client to the v4 example on odata.org you get an InvalidOperationException:

https://services.odata.org/TripPinRESTierService/People

System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate) at Simple.OData.Client.V4.Adapter.Metadata.TryGetEntityType(String collectionName, IEdmEntityType& entityType) at Simple.OData.Client.V4.Adapter.Metadata.IsTypeWithId(String collectionName) at Simple.OData.Client.Adapter.MetadataCache.b__37_0(String x) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Simple.OData.Client.Adapter.MetadataCache.IsTypeWithId(String typeName) at Simple.OData.Client.V4.Adapter.ResponseReader.CreateAnnotations(ODataResource odataEntry) at Simple.OData.Client.V4.Adapter.ResponseReader.ConvertEntry(ResponseNode entryNode, Object entry) at Simple.OData.Client.ResponseReaderBase.EndEntry(Stack`1 nodeStack, ResponseNode& rootNode, Object entry) at Simple.OData.Client.V4.Adapter.ResponseReader.ReadResponse(ODataReader odataReader) at Simple.OData.Client.V4.Adapter.ResponseReader.d__3.MoveNext()

moh-hassan commented 6 years ago

I get the same error for the same odata service when executing the following code

             IEnumerable<Person> data = await client.For<Person>()                
                 .FindEntriesAsync();

The strange in error is why call System.Linq.Enumerable.SingleOrDefault

moh-hassan commented 6 years ago

Any response?

object commented 5 years ago

Unfortunately I haven't had the time to look into this issue. I am very busy with other project, which makes it hard to find time to investigate and resolve issues reported lately.