Problem reading object back out of ISO

Feb 9, 2011 at 4:46 PM

I'm successfully writing and reading with one class, but am having trouble with another.

The problem class has a few strings, an ObservableCollection of a complex object and a simple string/string dictionary.

I save the object, and for debug purposes, I read it back into another variable, and it's just perfect.

I exit the app, restart, and when I try to read the object using the same key as the line above in debug, I get an Index out of bounds error.

I've defined tables for all sub-entries in my complex object, and didn't have any effect on it.

Any thoughts as to why I can do a write followed immediately by a read and it be ok, yet when I restart the app it throws an exeption?



Feb 9, 2011 at 4:50 PM

Hmm what I have done is saved all my tables separately even when it is a "complex type".

For example, If I have a Customer object and that customer has Orders. I Still save the Customer object and the Orders objects separately. When pulling the data up, I get the customer, then I make a separate query to get the Orders.

Feb 9, 2011 at 5:07 PM


Do you know what version of Sterling you are working with? We did have an issue with the application lifecycle that was addressed on Februrary 3rd, this changeset:

They were seeing this after a purge call however, so it may not be related. Can you confirm the version and if it is prior to this, try it out with the latest?

If you can't do that, or if it is still broken, let me know. I'll create a unit test and then fix it. Not sure if you've looked at the tests, but would TestModel be a decent candidate for a "complex object"? If so, I can do this:

Create a master class with a string, a Dictonary of string, string, and an ObservableCollection of TestModel.

Save it, simulate an application restart, load it and compare. Does that sound like a decent repro? Let me know and we'll get it addressed for you.

Feb 9, 2011 at 5:17 PM


I am using the 72883 changeset... my co-worker pulled it yesterday and I built it this morning.

Your suggestion might be a good try.

I just pulled Sterling local as part of my project rather than referencing the dll in hopes that I can get some stack tracing or something when I'm getting the exception.

I don't believe the excpetion has changed since I've been adding all the table references for sub-objects... that may or may not be useful information, but if it was pooting because I didn't have something defined, I would have expected it to change.

I've got 8 table references in for this one object, counting the object itself.



Feb 9, 2011 at 7:35 PM

OK this evening I'll recreate it with a test and if I'm successful, work on the fix.

Feb 9, 2011 at 9:19 PM

Dave, I just added a complex nested group of models to the test. The test model is already somewhat nested:

public class TestModel
        public TestModel()
            SubClass = new TestSubclass();

        private static int _idx;

        public const int SAMPLE_CONSTANT = 2;

        public int Key { get; set; }

        public string Data { get; set; }
        public string Data2 { get; set; }

        public TestSubclass SubClass { get; set; }

        public TestSubclass2 SubClass2 { get; set; }

        public TestSubStruct SubStruct { get; set; }

        public TestModelAsListModel Parent { get; set; }

        public DateTime Date { get; set; }

Then I add a model with an observable collection of the test model:

public class TestComplexModel
        public int Id { get; set; }
        public Dictionary<string, string> Dict { get; set; }
        public ObservableCollection<TestModel> Models { get; set; }

After saving, then completely shutting down Sterling and restarting, I read it back in and compare everything and it all checks out.

I'm guessing I'll need to see your code in more detail to troubleshoot this one - are you sure flush is being called when it's all said and done? Are you able to share with me the object graph you are trying to save and database definitions?

You know my email so feel free to shoot it over if you can.


Feb 12, 2011 at 3:06 AM

Dave, thanks for bringing this to my attention and I'm happy we were able to track it down and fix it for you!

Feb 12, 2011 at 4:25 PM

AWESOME, Jeremy...

This version works perfectly, and I've put up a blog post about it:

Sterling Object-Oriented Database for ISO 1.0 Released! -

Thanks so much!