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
Trying to read an object which contains a Set as a field causes a runtime error.
Writes don't cause such a crash, but it is not clear whether the data was correctly stored.
Repro code
#r "nuget: LiteDB.FSharp"openLiteDBopenLiteDB.FSharpopenLiteDB.FSharp.Extensionsletdatabase=letmapper= FSharpBsonMapper()letconnStr="Filename=Lite.db;mode=Exclusive"new LiteDatabase(connStr, mapper)typeFoo={ Id:string
Field:Set<int>}letdata= database.GetCollection<Foo>"data"letselect id =
data.findOne <@fun x -> x.Id = id @>letupsert datum =match data.tryFindOne <@fun x -> x.Id = datum.Id @>with| None -> data.Insert(datum)|> ignore
| Some _-> data.Update(datum)|> ignore
upsert { Id ="test"; Field = Set.empty }
select "test"// fails here
Error information
When running the previous snippet, this is the stack trace I get:
System.Exception: Could not extract element type from collection of type Microsoft.FSharp.Collections.FSharpSet`1[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1433.Invoke(String message) in /build/dotnet-core/src/dotnet-source-build/artifacts/src/fsharp.7ce7132f1459095e635194d09d6f73265352029a/src/fsharp/FSharp.Core/printf.fs:line 1433
at LiteDB.FSharp.Bson.rewriteKey@100(FSharpList`1 keys, BsonDocument entity, Type entityType, String key)
at LiteDB.FSharp.Bson.rewriteIdentityKeys@98(Type entityType, BsonDocument entity)
at LiteDB.FSharp.Bson.deserializeByType(BsonDocument entity, Type entityType)
at LiteDB.FSharp.Bson.deserialize[t](BsonDocument entity)
at LiteDB.FSharp.FSharpBsonMapper.ToObject[t](BsonDocument entity)
at LiteDB.LiteCollection`1.Find(Query query, Int32 skip, Int32 limit)+MoveNext()
at Microsoft.FSharp.Collections.SeqModule.TryHead[T](IEnumerable`1 source) in /build/dotnet-core/src/dotnet-source-build/artifacts/src/fsharp.7ce7132f1459095e635194d09d6f73265352029a/src/fsharp/FSharp.Core/seq.fs:line 1370
at FSI_0002.insert(Foo datum)
at <StartupCode$FSI_0002>.$FSI_0002.main@()
Stopped due to error
The text was updated successfully, but these errors were encountered:
Description
Trying to read an object which contains a
Set
as a field causes a runtime error.Writes don't cause such a crash, but it is not clear whether the data was correctly stored.
Repro code
Error information
When running the previous snippet, this is the stack trace I get:
The text was updated successfully, but these errors were encountered: