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.

v3 Error on inserting: Can only unbox from an object or interface type to a value type.

See original GitHub issue

Hi,

i’m trying out the new v3 in a Xamarin.Forms project.

When i try to insert a new object into a new collection i get this error message:

Unhandled Exception: System.ArgumentException: Can only unbox from an object or interface type to a value type. at System.Linq.Expressions.Expression.Unbox (System.Linq.Expressions.Expression expression, System.Type type) [0x00051] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs:678 at LiteDB.Reflection.CreateGenericSetter (System.Type type, System.Reflection.MemberInfo memberInfo) [0x00086] in <69119786c28e4052b478158c5831f742>:0 at LiteDB.BsonMapper.BuildEntityMapper (System.Type type) [0x0010e] in <69119786c28e4052b478158c5831f742>:0 at LiteDB.BsonMapper.GetEntityMapper (System.Type type) [0x00031] in <69119786c28e4052b478158c5831f742>:0 at LiteDB.BsonMapper.SetAutoId (System.Object entity, LiteDB.LiteCollection1[T] col) [0x0003e] in <69119786c28e4052b478158c5831f742>:0 at LiteDB.LiteCollection1[T].Insert (T document) [0x0003c] in <69119786c28e4052b478158c5831f742>:0

It doesn’t matter if i only insert one object or a list of objects.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mbdavidcommented, Nov 27, 2016

Ok, it’s now published

1reaction
mbdavidcommented, Nov 24, 2016

yes @vkocjancic, will be “beta-2”, but only this weekend because i’m out of office this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# - Issues with boxing / unboxing / typecasting ints. I don't ...
Unboxing is an explicit conversion from the type object to a value type or from an interface type to a value type that...
Read more >
Boxing and Unboxing - C# Programming Guide
An unboxing operation consists of: Checking the object instance to make sure that it is a boxed value of the given value type....
Read more >
The 10 Most Common Mistakes in C# Programming
If you don't know whether the object you're using is a value type or reference ... Common C# Programming Mistake #3: Using improper...
Read more >
Autoboxing and Unboxing in Java
We are adding int primitive type values instead of Integer Object and the code is successfully compiled. It does not generate a compile-time ......
Read more >
What exactly is Boxing - Unboxing in C# : r/csharp
Boxing is used to store value types in the garbage-collected heap. Boxing is an implicit conversion of a value type to the type...
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