Hi everyone.
I am using an Access 2003 database for a project I'm working on, and I was trying to generate code against it.
When generating code, I get the following exception:
-------------------------------------------------8<-------------------------------------------------
Failed to compare two elements in the array.
An error of type "InvalidOperationException" occured while attempting to execute this template. To enable Just-In-Time debugging on this template set the "Debug" attribute to "True" in the "CodeTemplate" directive and add a "Debugger.Break()" statement in the template.
System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at SchemaExplorer.TableKeySchema..ctor(DatabaseSchema database, String name, String[] foreignKeyMemberColumns, String foreignKeyTableOwner, String foreignKeyTable, String[] primaryKeyMemberColumns, String primaryKeyTableOwner, String primaryKeyTable)
at SchemaExplorer.TableKeySchema..ctor(DatabaseSchema database, String name, String[] foreignKeyMemberColumns, String foreignKeyTable, String[] primaryKeyMemberColumns, String primaryKeyTable, ExtendedProperty[] extendedProperties)
at SchemaExplorer.ADOXSchemaProvider.GetTableKeys(String connectionString, TableSchema table)
at SchemaExplorer.TableSchema.get_Keys()
at SchemaExplorer.TableSchema.get_ForeignKeys()
at SchemaExplorer.TableSchema.a(TableSchema A_0, TableSchemaCollection A_1)
at SchemaExplorer.TableDependancyComparer.Compare(Object x, Object y)
at System.Array.GetPivotValue(IComparer comparer, Array keys, Int32 left, Int32 right)
--- End of inner exception stack trace ---
at System.Array.GetPivotValue(IComparer comparer, Array keys, Int32 left, Int32 right)
at System.Array.SorterObjectArray.QuickSort(Int32 left, Int32 right)
at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length, IComparer comparer)
at SchemaExplorer.TableSchemaCollection.Sort(IComparer comparer)
at _CodeSmith.NetTiers_cst.Go()
at _CodeSmith.NetTiers_cst.__RenderMethod1(TextWriter writer, Control control)
at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
at CodeSmith.Engine.CodeTemplate.RenderToString()
at ej.s()
-------------------------------------------------8<-------------------------------------------------
The generation works if I don't create relationships between tables.
Any ideas?