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
When calling the load Method T equals FeedItem. In the lambda I get an exception because it is read from db in a different object. This problem only occurs when the application is restarted on my Phone. As long as the application keeps running all queries and succeed.
The call to _Load eventually reaches this code in SerializationHelper... Where on line 408 (last line in this snippet) the code creates an instance of type FeedItem. So Far so Good.
/// <summary>/// Recursive load operation/// </summary>/// <param name="type">The type to save (passed to support NULL)</param>/// <param name="key">The associated key (for cycle detection)</param>/// <param name="br">The reader</param>/// <param name="cache">Cycle cache</param>publicobjectLoad(Typetype,objectkey,BinaryReaderbr,CycleCachecache){_logManager.Log(SterlingLogLevel.Verbose,string.Format("Sterling is de-serializing type {0}",type.FullName),null);if(_DeserializeNull(br)){returnnull;}// make a templatevarinstance=Activator.CreateInstance(type);
In this same method eventually we reach following code (line 455) Here the typeIndexer suddenly changes the type to Notification. This is where everything fails. Since Notification is a totally different type.
else{type=Type.GetType(_typeIndexer(br.ReadInt32()));if(instance.GetType()!=type){instance=Activator.CreateInstance(type);}// push to the stackcache.Add(type,instance,key);// build the reflection cache);if(!_propertyCache.ContainsKey(type)){//_CacheProperties(type);_CacheProperties(type);}}
This is my database format
publicclassMyDatabase:BaseDatabaseInstance{publicconststringFeedItemInstanceIdIndex="FeedItemInstanceIdIndex";publicconststringNotificationInstanceIdIndex="NotificationInstanceIdIndex";publicconststringNotificationUnreadIndex="NotificationUnreadIndex";protectedoverrideList<ITableDefinition>RegisterTables(){returnnewList<ITableDefinition>{CreateTableDefinition<Instance,int>(i =>i.Id),CreateTableDefinition<FeedItem,int>(f =>f.Id).WithIndex<FeedItem,int,int>(FeedItemInstanceIdIndex, fi =>fi.InstanceId),CreateTableDefinition<Notification,int>(n =>n.Id).WithIndex<Notification,int,int>(NotificationInstanceIdIndex, n =>n.InstanceId).WithIndex<Notification,bool,int>(NotificationUnreadIndex, n =>n.Unread)};}}
Any Idea how to solve this?
The text was updated successfully, but these errors were encountered:
After explaining the problem here I finally tried by removing the base class which is used for both the FeedItem and Notification. Then the serializer works.
So in order to solve this issue the serializer thingy should be enhanced to also support baseclasses correctly. Any idea where and how to solve the issue. With some little assistance I could fix it myself probably.
When calling the load Method T equals FeedItem. In the lambda I get an exception because it is read from db in a different object. This problem only occurs when the application is restarted on my Phone. As long as the application keeps running all queries and succeed.
The call to _Load eventually reaches this code in SerializationHelper... Where on line 408 (last line in this snippet) the code creates an instance of type FeedItem. So Far so Good.
In this same method eventually we reach following code (line 455) Here the typeIndexer suddenly changes the type to Notification. This is where everything fails. Since Notification is a totally different type.
This is my database format
Any Idea how to solve this?
The text was updated successfully, but these errors were encountered: