Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Internal Connection Fatal Error  Exception on calling Cancel on Asynchronous Call

Posted on 2010-11-12
8
Medium Priority
?
687 Views
Last Modified: 2012-05-10
I am using BeginExecuteNonQuery to call a long running stored procedure asynchronously. When the user wishes to cancel the operation I call the Cancel method .It works fine for the first time.Suppose user start the query again and cancels it the next time i get the following Exception System.InvalidOperationException: Internal Connection fatal error
0
Comment
Question by:shore-support
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34119287
Are you closing all the Connection or Transactions?

DaTribe
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34119289
I should have said Disposing of your Transactions.

DaTribe
0
 

Author Comment

by:shore-support
ID: 34119363
I am taking care of clearing the transaction and connection in the Method that'll be invoked in the PostAsyncCall.When the transaction has passed through successfully i get the transaction object in this Method and commit it but when it is cancelled i see that the transaction object returned in this Method is null
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Richard Lee
ID: 34119604
Firstly a null object doesn't mean that what this object was referencing previously has been disposed. Yes the object is abandoned but garbage collection is non-deterministic. What I am getting at is as follows:

If in your BeginAsync you create a transaction and in your PostAsync you dispose of it, then if we replace the PostAsync with CancelAsync disposing of the transaction should still be done here before setting the transaction object to null.

DaTribe
0
 

Author Comment

by:shore-support
ID: 34119850
When the user doesn't cancel the operation i get to see the Transaction Object in the IAsync Result which is passed to the Delegate and i commit the transaction and close the connection but when user Cancels i get null as the Transaction object in the same Delegate. I have even tried to use a global parameter for the Transaction and the Connection but i see even this Connection is closed in case of Cancel.
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34120042
Lets try again:

1. Is there an InnerException?
2. How is the transaction & connection being closed?
3. What is in the EventLog?
4. Implement some Debug.Trace to see what is happening.

DaTribe
0
 

Author Comment

by:shore-support
ID: 34246996
Thanks. We are trying the above approach to resolve the issue.
0
 
LVL 18

Accepted Solution

by:
Richard Lee earned 2000 total points
ID: 34291395
Any progress?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question