1
I am creating an application that makes multiple connections simultaneously. For each connection I create one TextBox and a BackgroundWorker. When executing the DoWork of BackgroundWorker I use several ProgressPercentage that initiate various types of functionality, from starting a timer to placing messages on TextBox.
My doubt is, when I do the routine on DoWork I left some exceptions as throw new NotImplementedException(); and implemented in RunWorkerCompleted a treatment for when that kind of mistake happened. However, when I am debugging, I end up stopping in the creation of error and not in the treatment within the RunWorkerCompleted. 
How do I get the error treated within the RunWorkerCompleted?
Below follows part of the code.
private void bgwMain_DoWorkSerial(object sender, DoWorkEventArgs e)
{
    startDownloadSerial();
}
private void bgwMain_ProgressChangedSerial(object sender, ProgressChangedEventArgs e)
{
    switch (e.ProgressPercentage)
    {
        case 0:
            msgTextDownload("Iniciando processo de download via Serial.");
            break;
        case 1:
            tmrDownloadDot = new Timer();
            tmrDownloadDot.Interval = 1000;
            tmrDownloadDot.Tick += TmrDownloadDot_Tick;
            msgTextDownload("Download iniciado.");
            msgTextDownload("");
            tmrDownloadDot.Start();
            break;
        case 2:
            tmrDownloadDot.Stop();
            msgTextDownload("Download finalizado.");
            break;
        default:
            throw new NotImplementedException();
    }
}
private void bgwMain_RunWorkerCompletedSerial(object sender, RunWorkerCompletedEventArgs e)
{
    if (e.Cancelled)
    {
        msgTextDownload("Operação cancelada pelo usuário.");
    }
    else if (e.Error != null)
    {
        msgTextDownload("Ocorreu um erro durante a aplicação: ");
        msgTextDownload("Source:" + e.Error.Source + "| Message: " + e.Error.Message);
    }
    else
    {
        msgTextDownload("Processo de download via serial finalizado.");
        if (e.Result != null)
        {
            try
            {
                msgTextDownload(e.Result.ToString());
            }
            catch (Exception ex)
            {
            }
        }
    }
}
In the code, the method msgTextDownload only prints the text in TextBox corresponding to BackgroundWorker.
