Writing to a control form another thread. RRS feed

  • Question

  • I have an application that uses a multi-line textbox to show output. It also uses Titanium Proxy which writes to the textbox from one of the handlers. This is achieved via telling the log subroutine that it is on another thread and using invoke. It works well.

        Sub Log_Message(Message As String, Optional Message_Is_From_Another_Thread As Boolean = False)
            Message &= Environment.NewLine
            If Message_Is_From_Another_Thread Then
                ' Ask the textbox to call for an update.
                Log.Invoke(Sub() Log.AppendText(Message))
            End If
        End Sub

    I am now trying to add additional functionality to the code so that it can download another file. The same code in the same handler calls this same function, and hangs on the invoke (until, after a minute, Selenium times out). So i am trying to figure out where the new functionality differs from the existing functionality, and why this causes a hang on invoke.

    There is an obvious difference in how they work. In the existing functionality, a button is clicked and a generated pdf is downloaded in a new tab (which Titanium usurps). In the new functionality, a button is clicked, but it reloads the same url with different html which itself includes an embedded pdf (which Titanium usurps).

    If i comment out the invoke, all works fine. Please help me: what am i doing wrong?

    Friday, September 20, 2019 3:57 PM

All replies

  • Hi,

    Is there any error returned by the Visual Studio editor?

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, September 25, 2019 1:24 AM
  • Yes.


    OpenQA.Selenium.WebDriverException: 'The HTTP request to the remote WebDriver server for URL http://localhost:53053/session/2a43933c6da603e545ebabbadc5c48f6/url timed out after 60 seconds.'

    Inner Exception:

    WebException: The operation has timed out


       at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
       at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
       at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
       at function in file at line xxx
       at function in file at line xxx
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at project.My.MyApplication.Main(String[] Args) in :line 81

    After a moment a popup shows up: 

    • Edited by Brian Tkatch Wednesday, September 25, 2019 3:18 PM
    Wednesday, September 25, 2019 3:17 PM