Issue when trying to create a table

Nov 19, 2010 at 9:55 PM

Hello,

I was trying to use the database and I wanted to create a table for a class called "DbVersion" and I was getting an Exception when trying to open the database. This was because when it was trying to create the table, the type returned from reflection was null. After some digging around I found out that you use the following function to get the string to save from the type:

private string CreateFormattedTableType(Type rowType)
{
string returnValue = rowType.AssemblyQualifiedName.Substring(0, rowType.AssemblyQualifiedName.IndexOf("Version")) + "Version=..., " + rowType.AssemblyQualifiedName.Substring(rowType.AssemblyQualifiedName.IndexOf("Culture"));

return returnValue;
}

the problem here is that since you are getting a substring until the "Version" literal, any Type a name that happens to contain the literal "version" will result in a wrong string to be saved thus failing to load.

Coordinator
Nov 20, 2010 at 8:44 PM

Thanks.  I will try to address the bug this weekend.  If you do want want to wait, I think the fix is pretty simply.  Just change all instances of IndexOf to LastIndexOf.

Sergey

Nov 21, 2010 at 9:48 AM

Thanks for the quick reply. My "quick" solution when I finally figured out what was happening was to rename my table :)