Thread hanging

0

My system has a method that puts each triggered event into a thread , save, edit, search, everything goes to a thread .

  backgroundWorker.DoWork += acaoProcessamento;
  backgroundWorker.RunWorkerCompleted += (s, a) =>
  {
        this.ocooreuErro = a.Error != null;
        if ((a.Cancelled == true))
              this.lblDescricao.Text = "Cancelado!";            
        this.Refresh();
        this.Close();
  };

  backgroundWorker.RunWorkerCompleted += acaoConcluir;
  backgroundWorker.ProgressChanged += (s, a) =>
  {
        prbProgresso.Value = Math.Min(100, a.ProgressPercentage);
        prbProgresso.Style = prbProgresso.Value == 100
            ? ProgressBarStyle.Marquee
            : ProgressBarStyle.Continuous;
        prbProgresso.Visible = prbProgresso.Value > 0;
        if (a.UserState != null)
              lblDescricao.Text = a.UserState.ToString();
  };
  backgroundWorker.ReportProgress(0);
  backgroundWorker.RunWorkerAsync();
  this.ShowDialog();

But a specific routine when it arrives at this this.ShowDialog(); , does not fire any Exception , does not give error, nothing, just stops the application in that line and does not walk anymore. At first I will not post any more codes because I do not know which part of the code could help.

    
asked by anonymous 29.09.2014 / 21:54

1 answer

1

Without concrete evidence of the state you are in, it is very difficult to locate the problem. So my recommendation is to activate an operation trace.
Log in relevant context information:

var linha = new StackTrace(new StackFrame(true)).GetFrame(0).GetFileLineNumber();
var nome = Assembly.GetExecutingAssembly().GetName().Name.ToString();
Debug.WriteLine(nome + "-" + linha + "-Variavel tal : " + sProdName );

You can use DebugView to capture your messages.

    
30.09.2014 / 13:47