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
Describe the bug
Using this version and 5.0.15 leads to System.Reflection.AmbiguousMatchException: Ambiguous match found
after some time of usage
Code to Reproduce
its simple - just make a simple multithread code to generate and insert/update typed objects inside of a collection
we use the following class:
public class Cookie
{
public long Id { get; set; }
public string Guid { get; set; }
public long Long { get; set; }
public CookieCollection cookieCollection { get; set; }
}
Expected behavior
should not be any issue
Screenshots/Stacktrace
at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetMethod(String name, BindingFlags bindingAttr)
at LiteDB.BsonMapper.DeserializeList(Type type, BsonArray value)
at LiteDB.BsonMapper.Deserialize(Type type, BsonValue value)
at LiteDB.BsonMapper.DeserializeObject(EntityMapper entity, Object obj, BsonDocument value)
at LiteDB.BsonMapper.Deserialize(Type type, BsonValue value)
at LiteDB.LiteQueryable1.<ToEnumerable>b__27_2(BsonDocument x) at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at LiteDB.LiteCollection`1.FindById(BsonValue id)
Additional context
The text was updated successfully, but these errors were encountered:
okarpov
changed the title
[BUG] Using string Guid as Id leads to System.Reflection.AmbiguousMatchException: Ambiguous match found after some time
[BUG] Using string Guid as Id leads to System.Reflection.AmbiguousMatchException: Ambiguous match found
Apr 11, 2023
okarpov
changed the title
[BUG] Using string Guid as Id leads to System.Reflection.AmbiguousMatchException: Ambiguous match found
[BUG] System.Reflection.AmbiguousMatchException: Ambiguous match found
Apr 11, 2023
removing public CookieCollection cookieCollection { get; set; } property seems solving the issue
but then there is another issue - can not add same _id value
Hi, I found same issue when deserializing list.
The bug is in line 260 of file BsonMapper.Deserialize.cs.
The affected line is the following:
var addMethod = type.GetMethod("Add");
Which could cause problem when type contains more than one Add method but deserialize needs only the one having
as argument itemType.
So if you do the following:
var addMethod = type.GetMethod("Add", new Type[] { itemType });
it solves the issue.
Please let me know if the bug fix can be released soon.
Thanks in advance.
PS: I created a pull request for it #2332
Regards
Luigi
Version
5.0.16
Describe the bug
Using this version and 5.0.15 leads to System.Reflection.AmbiguousMatchException: Ambiguous match found
after some time of usage
Code to Reproduce
its simple - just make a simple multithread code to generate and insert/update typed objects inside of a collection
we use the following class:
Expected behavior
should not be any issue
Screenshots/Stacktrace
at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetMethod(String name, BindingFlags bindingAttr)
at LiteDB.BsonMapper.DeserializeList(Type type, BsonArray value)
at LiteDB.BsonMapper.Deserialize(Type type, BsonValue value)
at LiteDB.BsonMapper.DeserializeObject(EntityMapper entity, Object obj, BsonDocument value)
at LiteDB.BsonMapper.Deserialize(Type type, BsonValue value)
at LiteDB.LiteQueryable
1.<ToEnumerable>b__27_2(BsonDocument x) at System.Linq.Enumerable.SelectEnumerableIterator
2.MoveNext()at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable
1 source, Boolean& found) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source)at LiteDB.LiteCollection`1.FindById(BsonValue id)
Additional context
The text was updated successfully, but these errors were encountered: