I have a very strage problem with the SqlQuery.ExecuteAsCollection<T>() method and I am not sure whether this is related to SubSonic, my database or .NET.
When the following line gets executed:
FlowerCollection myCollection = sqlQuery.ExecuteAsCollection<FlowerCollection>();
my application crashes with the IndexOutOfRangeException that occured in System.Data.dll and the Additional Information containing the name of a column in the Flower table (which does exist both in the database itself and in the generated SubSonic class). However when I execute the same line in the Command Widnow or in the Watch window I get the result I expect without any errors.
I tried to load the debug symbols for .NET but in this case there seem to be no source code available so I am not able to debug it like that.
Have you got any ideas what else I can try to find the bug?
EDIT: I just added a try/catch around this code block and it throws exeptions for each column in the Flower table.
I found a workaround...
my original
SqlQuerywas constructed with an argument limiting the columns in the result:after I removed the argument from the
Selectconstructor it runs without throwing any exception:Why it worked in the
Command&Watchin spite of this remains a mistery...