This project is read-only.

Unhandled Exception creating a Connection

Jul 5, 2015 at 6:19 AM
Edited Jul 5, 2015 at 7:10 AM
This line of code was causing a deadlock when I call it from the UI thread:
m_connection = new Connection(Address);

I used the ThreadPool to run the code and it eliminated the deadlock but now my process crashes whenever an error occurs during connect. I have a try-catch block in my thread handler so it is not my code.

I suspect the problem comes from this line in TcpTransport.cs
this.ConnectAsync(address, factory).Wait();

I also tried:

var result = Connection.Factory.CreateAsync(Address);
m_connection = result.Result;

and still get the unhandled exception.

I don't know how to fix the issue but a process crash on error is show stopper problem.
Jul 8, 2015 at 6:01 PM
From the UI thread, you can use the ConnectionFactory.CreateAsync method to create the connection asynchronously. That should resolve the deadlock issue.

If you handle the exceptions thrown by the API calls, the process should not crash. If you see an unhandled exception inside the library, please share the call stack here.