Is there any way to cancel backgroundworker after x second (ie. timeout 5 second) if the worker is still busy processing a single code line? (never go to the end of While loop to check for CancellationPending)? Example:
Private Sub DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
        Dim worker As BackgroundWorker = DirectCast(sender, BackgroundWorker)
        While Not worker.CancellationPending
            Dim args As ArgumentType = CType(e.Argument, ArgumentType)
            Try
            process #1
            process #2 --> hanging here. Never throw exception.
            ...
            process #n
            Catch ex as Exception
            'Never come here
            End Try
        End While
End Sub