Unhandled exception using Streaming API

Feb 20, 2014 at 8:07 PM
Edited Feb 20, 2014 at 8:12 PM
Hello !

I am trying to correctly handle errors when using LinqToTwitter with Streaming API.

Once the streaming has begun, if a network disconnection happens, LinqToTwitter gently call my callback method with error as description. It is perfect ! I just have to wait a couple of seconds and retry.

But when I start the Streaming without network, an unhandled exception is thrown. My "try/catch" blocks are never called, and there is no way for me to prevent the application from closing.

I am only using the StreamingDemo/FilterDemo code.

The problem seems to be in the file LinqToTwitter/TwitterExecute.cs. The method ExecuteTwitterStream is executed in a background thread. The line "req.BeginGetResponse(" is only in a try/finally block. So when it fails, the thread crash and the whole application with it.
Why can't we add some catch block ?
                try { ... }
                catch (Exception ex)
                    WriteLog(ex.ToString(), "ExecuteTwitterStream");
                finally { ... }
in the same way it is done in the main loop when the stream is read ?
Feb 24, 2014 at 12:37 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.