I have a try/catch block and within catch am trying to apply a pause but no matter what method I try (pause, threadsleep) it simply continues. and ignores all pauses in the mainblock. Is this a .NET bug?
catch (Exception ex)
{
if (maxDelay < 1)
maxDelay = 1;
newpause(maxDelay);
// Pause(maxDelay * 60);
Current = "Error:" + txt;
LogUpdater.UpdateLog(f, "Error sending : " + txt + ".");
System.Threading.Thread.Sleep(10);
bw.ReportProgress(1);
}
public void newpause(int maxDelay)
{
for (int i = 0; i < 60; i++)
{
System.Threading.Thread.Sleep(maxDelay*1000);
Application.DoEvents();
}
}
Please try running following code. It works on my side.
Let me know if this helps!