Catching bug with InvalidCastException while mapping SQL query results to object

Hi! I'm using LINQ in real product development. It is great even now!!

I use

public System.Collections.Generic.IEnumerable<T> ExecuteQuery<T>(string query,paramsobject[] parameters);

to obtain query results and map them to my object.

It works fine until I've changed query string (changes does not affect query schema but only data).

There's anSystem.InvalidCastExceptionwithMessage="Specified cast is not valid."while trying to enumerate result. By commenting different properties of my class I've found out where the problem is. But this approach is time consuming. Here is the question:

How to find out which property mapping caused exception?

[1229 byte] By [vial] at [2007-12-20]
# 1
Currently, there is no better way. Thanks for pointing it out though. We will likely improve error messages to give you more information.
MattWarren at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...

Visual Studio Orcas

Site Classified