-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.InvalidCastException at LiteDB.PageService.GetPage[T] #81
Comments
@ninjabear @jbeemster any one of you able to help here? |
I think it's got to be one of these problems in LiteDB @BenFradet which is used to cache events before they are sent to collectors. I think long term we should replace LiteDB, 1.0.1 and 1.0.2 were already triggered by LiteDB bugs. The problem is finding a .netstandard compatible db. It just needs to implement this interface. The storage interface can also be implemented in client-side code to provide your own storage mechanism which may be the solution here. There's some code somewhere for an in memory implementation of the storage interface which may be of help. |
Thanks for your answer. I will look for implementing my own storage. |
Hey @Amazia I dug up an example (I would look to implement your own!) of custom storage: Implementing IStorage
Building the tracker using custom storage
If you've already got a nice data store you can wire it up similarly to this. The team is tied up with other projects at the moment but we're always appreciative of PRs if you can find the time or it would make your life easier (thinking about #82 too). |
Thanks for your comment :) |
Hi,
I use snowplow-dotnet-tracker inside a Xamarin iOS application.
I encounter this exception that crash my application:
Application Specific Information:
*** Terminating app due to uncaught exception 'System.AggregateException', reason: 'System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.InvalidCastException: Specified cast is not valid.
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
at LiteDB.PageService.GetPage[T] (System.UInt32 pageID) <0x101946b20 + 0x00107> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.PageService.GetFreePage[T] (System.UInt32 startPageID, System.Int32 size) <0x1019470a0 + 0x00043> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.DataService.Insert (LiteDB.CollectionPage col, System.Byte[] data) <0x101942100 + 0x0007f> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine.InsertDocument (LiteDB.CollectionPage col, LiteDB.BsonDocument doc) <0x101932f40 + 0x001c7> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine+<>c__DisplayClass18_0.b__0 (LiteDB.CollectionPage col) <0x101938830 + 0x0008b> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine.Transaction[T] (System.String collection, System.Boolean addIfNotExists, System.Func
2[T,TResult] action) <0x10197b200 + 0x00100> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0 at LiteDB.LiteEngine.Insert (System.String collection, System.Collections.Generic.IEnumerable
1[T] docs) <0x101932d50 + 0x0016f> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0at LiteDB.LiteEngine.Insert (System.String collection, LiteDB.BsonDocument doc) <0x101932c80 + 0x00073> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteCollection
1[T].Insert (T document) <0x10191e330 + 0x00103> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0 at Snowplow.Tracker.Storage.LiteDBStorage.Put (System.String item) <0x1018fee20 + 0x000d7> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0 at Snowplow.Tracker.Queues.PersistentBlockingQueue.Enqueue (System.Collections.Generic.List
1[T] items) <0x1018ff660 + 0x0011b> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0at Snowplow.Tracker.Emitters.AsyncEmitter.Input (Snowplow.Tracker.Models.Payload payload) <0x101908980 + 0x000b7> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0
at Snowplow.Tracker.Tracker+<>c__DisplayClass46_0.b__0 () <0x1018fdda0 + 0x0003f> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0
at System.Threading.Tasks.Task.InnerInvoke () <0x10047d850 + 0x0005f> in <b238a3153e534349ad10ed0787f2157a#7af7393f81f215f195fc3bd1f6181fba>:0
at System.Threading.Tasks.Task.Execute () <0x10047cf50 + 0x00043> in <b238a3153e534349ad10ed0787f2157a#7af7393f81f215f195fc3bd1f6181fba>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.InvalidCastException: Specified cast is not valid.
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
at LiteDB.PageService.GetPage[T] (System.UInt32 pageID) <0x101946b20 + 0x00107> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.PageService.GetFreePage[T] (System.UInt32 startPageID, System.Int32 size) <0x1019470a0 + 0x00043> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.DataService.Insert (LiteDB.CollectionPage col, System.Byte[] data) <0x101942100 + 0x0007f> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine.InsertDocument (LiteDB.CollectionPage col, LiteDB.BsonDocument doc) <0x101932f40 + 0x001c7> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine+<>c__DisplayClass18_0.b__0 (LiteDB.CollectionPage col) <0x101938830 + 0x0008b> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteEngine.Transaction[T] (System.String collection, System.Boolean addIfNotExists, System.Func
2[T,TResult] action) <0x10197b200 + 0x00100> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0 at LiteDB.LiteEngine.Insert (System.String collection, System.Collections.Generic.IEnumerable
1[T] docs) <0x101932d50 + 0x0016f> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0at LiteDB.LiteEngine.Insert (System.String collection, LiteDB.BsonDocument doc) <0x101932c80 + 0x00073> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0
at LiteDB.LiteCollection
1[T].Insert (T document) <0x10191e330 + 0x00103> in <b99fd1821def4ff9a5794b6636ed75ad#7af7393f81f215f195fc3bd1f6181fba>:0 at Snowplow.Tracker.Storage.LiteDBStorage.Put (System.String item) <0x1018fee20 + 0x000d7> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0 at Snowplow.Tracker.Queues.PersistentBlockingQueue.Enqueue (System.Collections.Generic.List
1[T] items) <0x1018ff660 + 0x0011b> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0at Snowplow.Tracker.Emitters.AsyncEmitter.Input (Snowplow.Tracker.Models.Payload payload) <0x101908980 + 0x000b7> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0
at Snowplow.Tracker.Tracker+<>c__DisplayClass46_0.b__0 () <0x1018fdda0 + 0x0003f> in <b17d47f385b747f9a219933145b544a2#7af7393f81f215f195fc3bd1f6181fba>:0
at System.Threading.Tasks.Task.InnerInvoke () <0x10047d850 + 0x0005f> in <b238a3153e534349ad10ed0787f2157a#7af7393f81f215f195fc3bd1f6181fba>:0
at System.Threading.Tasks.Task.Execute () <0x10047cf50 + 0x00043> in <b238a3153e534349ad10ed0787f2157a#7af7393f81f215f195fc3bd1f6181fba>:0 <---
And this one:
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
LiteDB.PageService.GetPage(uint pageID)
LiteDB.DataService.GetBlock(PageAddress blockAddress)
LiteDB.DataService.Read(PageAddress blockAddress)
LiteDB.LiteEngine.d__9.MoveNext()
LiteDB.LiteCollection.d__17.MoveNext()
System.Collections.Generic.EnumerableHelpers.ToArray(IEnumerable source, ref int length)
System.Linq.Buffer.Buffer(IEnumerable source)
System.Linq.OrderedEnumerable.ToList(int minIdx, int maxIdx)
System.Linq.OrderedPartition.ToList()
System.Linq.Enumerable.ToList(IEnumerable source)
Snowplow.Tracker.Storage.LiteDBStorage.TakeLast(int n)
Snowplow.Tracker.Queues.PersistentBlockingQueue.Peek(int count, int maxWait)
Snowplow.Tracker.Emitters.AsyncEmitter.loop()
System.Threading.ThreadHelper.ThreadStart_Context(object state)
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, object state, bool preserveSyncCtx)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state, bool preserveSyncCtx)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)
System.Threading.ThreadHelper.ThreadStart()
Thanks for helping
The text was updated successfully, but these errors were encountered: