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.

System.NotSupportedException: 'BSON type not supported'

See original GitHub issue

Hi everybody, I’ve just faced an issue with my LiteDb. After some period of work I found this error in my stackTrace (BSON type not supported). I attached link where you can get db file. It’s crashing while I am trying to open ‘matches’ table.

System.NotSupportedException: ‘BSON type not supported’.

at LiteDB.BsonReader.ReadElement(ByteReader reader, String& name) at LiteDB.BsonReader.ReadDocument(ByteReader reader) at LiteDB.QueryCursor.Fetch(TransactionService trans, DataService data, BsonReader bsonReader) at LiteDB.LiteEngine.Find(String collection, Query query, Int32 skip, Int32 limit)+MoveNext() at LiteDB.LiteEngine.Find(String collection, Query query, String[] includes, Int32 skip, Int32 limit)+MoveNext() at LiteDB.LiteCollection1.Find(Query query, Int32 skip, Int32 limit)+MoveNext() at System.Collections.Generic.List1.AddEnumerable(IEnumerable1 enumerable) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at RoboWin.BLL.Components.MatchComponent.Services.MatchService.GetAll() in C:\Users\Dim_mon\Desktop\RoboWin\server\RoboWin\RoboWin.BLL\Components\MatchComponent\Services\MatchService.cs:line 30 at RoboWin.Server.Controllers.MatchesController.GetAll() in C:\Users\Dim_mon\Desktop\RoboWin\server\RoboWin\RoboWin.Server\Controllers\MatchesController.cs:line 35 at lambda_method(Closure , Object , Object[] ) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()

My db dump https://drive.google.com/open?id=1X3K7AnM-Nzx2NH-cXykTeBRI63bCqgYk

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
leandromolinacommented, Jan 22, 2021

I have the same problem, There is still no solution for this problem?

1reaction
Szilard95commented, Apr 30, 2019

Hi, I have a similar issue, but think I found the problem.

Looks like when serializing dictionaries, if the key string contains null bytes (returned by ToString() call on the key object), it gets serialized as-is, see BsonMapper.Serialize.cs#L141.

Then, during reading BSON elements, exceptions occur because those null bytes, see BsonReader.cs#L147. The BSON reader reads the null byte int the type variable, and null is not a valid type value. The previously read element becomes the key string up to the first null byte.

To solve this, I changed the above mentioned dictionary serialization line to the following:

o.RawValue[key.ToString().Replace("\0", string.Empty)] = this.Serialize(type, value, depth);

Hope this helps someone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

System.NotSupportedException: 'BSON type not supported'
Hi everybody, I've just faced an issue with my LiteDb. After some period of work I found this error in my stackTrace (BSON...
Read more >
c# - Getting a System.NotSupportedException when using ...
and it worked the data that I wanted. I know that when using the MongoDB.Driver I am using their Linq and Queryable objects....
Read more >
2.19 breaks projections? - Drivers & ODMs
Just upgraded to 2.19 and any query using .Project is failing. Originally I thought it may have been due to the AllowedTypes feature, ......
Read more >
Snowplow unity-tracker 0.6.1 error - Troubleshooting
NotSupportedException: Specified method is not supported. at System.Threading.Mutex..ctor (System.Boolean initiallyOwned, System.
Read more >
Migrate from Newtonsoft.Json to System.Text.Json - .NET
Not supported, but workaround is possible. The workarounds are custom converters, which may not provide complete parity with Newtonsoft.Json ...
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