Wednesday, 1 March 2006

Bug: Refreshing schema of ObjectDataSource causes error

I think I've found another bug in Visual Studio.NET :-(

I've got some DataObject classes that return arrays of objects. These used to return collections (using the System.Collections.ObjectModel.Collection generic class). I updated them to return simple arrays as I thought that would be more efficient.

Turns out that while ASP.NET seems to work fine with this, the design experience in Visual Studio isn't so good. Clicking on the 'Refresh Schema' task on the ObjectDataSource control that references the data object method, causes a "The schema of type 'Class1[]' could not be retrieved. Operation is not valid due to the current state of the object" error to be displayed.

6 comments:

Anonymous said...

Could you find a way to solve this problem ?

David Gardiner said...

I logged the bug, but there isn't really a nice way around this for now.

Having said that, I've since decided that Collections are probably a better way to go, so it hasn't been a big problem.

Anonymous said...

I solved this by putting the returned rows into a datatable instead of an array.

Hend said...

thanks so much, datatable solved the problem

Hend said...

Thanks, Datatable solved the problem

Anonymous said...

datatable really solved the problem