473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with async ADO.NET

Hi everyone,
I'm having a problem with the new asynchrounous ADO.NET operations
(specifically BeginExecuteReader & EndExecuteReader), and was wondering
if anyone else has had similar issues?

I'm getting the following exception:
System.InvalidOperationException: The asynchronous operation has
already completed.
at
System.Data.SqlClient.SqlCommand.VerifyEndExecuteS tate(DbAsyncResult
dbAsyncResult, String endMethod)
at
System.Data.SqlClient.SqlCommand.InternalEndExecut eReader(IAsyncResult
asyncResult, String endMethod)
at System.Data.SqlClient.SqlCommand.EndExecuteReader( IAsyncResult
asyncResult)

Inside the second of the following two methods:

public override void GetAsyncResponse(SessionState state)
{
this.state = state;
state.Response = new SSETIResponse("INB1");
con.Open();
asyncCom = new SqlCommand("sy_inetnewbasket", con);
asyncCom.CommandType = CommandType.StoredProcedure;
Database.BeginExecuteReader(asyncCom, new
AsyncCallback(FinishedWaiting), state);
}

protected void FinishedWaiting(IAsyncResult res)
{
try
{
object o = null;
using(SqlDataReader rdr = asyncCom.EndExecuteReader(res))
{
if(rdr.Read()) o = rdr[0];
}
state.Response.Body = (o == null || o == Convert.DBNull) ? "F" :
int.Parse(o.ToString()).ToString("00000000");
state.SendMessageCallback(state);
}
catch(Exception e)
{
SSETIException.HandleMessageException(e, state);
}
}

I don't see how the .EndExecuteReader could ever get called twice with
the same IAsyncResult - and it only happens under high load (its a
server app) so I'm beginning to think its some weird threading issue
inside the framework?

Any help anyone could add would be great - even if it is just a "its a
bug!" message!

Cheers,
Kieran

Nov 17 '05 #1
0 1068

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Shawn Meyer | last post by:
Hello - I am trying to write a class that has an async BeginX and EndX, plus the regular X syncronous method. Delegates seemed like the way to go, however, I still am having problems getting...
0
by: Manfred Braun | last post by:
Hi All, I have a problem reading queue-messages async. My QueueReader has a Start() and a Stop() method and if my app starts, it calls Start(). The problem is, that there are possibly several...
3
by: mayur1 | last post by:
Hello everybody, I am trying to connect to DB2 V 8.1 on Red Hat Linux V5 from WebSphere Application Server V6 on Windows Server 2003. The problem that i am facing is that its not able to opent...
10
by: Frankie | last post by:
It appears that System.Random would provide an acceptable means through which to generate a unique value used to identify multiple/concurrent asynchronous tasks. The usage of the value under...
1
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.