C
Carl Johansson
Running my application (C# VS 2008 Pro) causes an InvalidCastException with
the following message:
"Unable to cast object of type 'System.Data.Common.DbAsyncResult' to type
'System.Runtime.Remoting.Messaging.AsyncResult'."
However, VS intellisense is unable to find the DbAsyncResult type, I can't
find DbAsyncResult in the help files, I can't find DbAsyncResult in the VS
"Object Browser"
window, and I find next to nothing on the web and in the newsgroups. What's
going on???
The exception occurs inside a delegate method of type System.AsyncCallback
which looks like this:
private static void SqlServerDone(System.IAsyncResult itfAR)
{
// InvalidCastException next!
System.Runtime.Remoting.Messaging.AsyncResult ar =
(System.Runtime.Remoting.Messaging.AsyncResult)itfAR;
System.Data.SqlClient.SqlCommand sqlCm =
(System.Data.SqlClient.SqlCommand)ar.AsyncDelegate;
using (System.Data.SqlClient.SqlDataReader sqlDr =
sqlCm.EndExecuteReader(itfAR))
{
...
}
}
Regards Carl Johansson
__________ Information from ESET Smart Security, version of virus signature database 4434 (20090917) __________
The message was checked by ESET Smart Security.
http://www.eset.com
the following message:
"Unable to cast object of type 'System.Data.Common.DbAsyncResult' to type
'System.Runtime.Remoting.Messaging.AsyncResult'."
However, VS intellisense is unable to find the DbAsyncResult type, I can't
find DbAsyncResult in the help files, I can't find DbAsyncResult in the VS
"Object Browser"
window, and I find next to nothing on the web and in the newsgroups. What's
going on???
The exception occurs inside a delegate method of type System.AsyncCallback
which looks like this:
private static void SqlServerDone(System.IAsyncResult itfAR)
{
// InvalidCastException next!
System.Runtime.Remoting.Messaging.AsyncResult ar =
(System.Runtime.Remoting.Messaging.AsyncResult)itfAR;
System.Data.SqlClient.SqlCommand sqlCm =
(System.Data.SqlClient.SqlCommand)ar.AsyncDelegate;
using (System.Data.SqlClient.SqlDataReader sqlDr =
sqlCm.EndExecuteReader(itfAR))
{
...
}
}
Regards Carl Johansson
__________ Information from ESET Smart Security, version of virus signature database 4434 (20090917) __________
The message was checked by ESET Smart Security.
http://www.eset.com