I am running a Windows form program that does all its work on another thread. After some time, the UI freezes and stops responding. The background thread is still working fine (I can see that from the work done).
I got this exception:
A first chance exception of type 'System.IndexOutOfRangeException' in exe
When I traced the line of exception and ran it again, I got this:
The thread
<No Name>
(0x19b4) has exited with code 0 (0x0).
The line of code runs fine but it gives a System.IndexOutofRangeException
.
MatchCollection tempcollection = Regex.Matches(document,
"(?<data>More information from(.|\\r|\\n)*?</div>)");
if (tempcollection.Count == 0)
{
return Result;
}
string ThisDiv = tempcollection[0].Groups["data"].Value;
// The above line shows exception in Output Window,
// otherwise it works fine and moves to next line.
UPDATE: I've seen that output gives information about every exception whether it is caught or not ,I thought that is cause of freezing UI but that is not.
- Kindly help me to get rid of this exception.
- Is it an Unchecked exception; I learned in my studies that .Net does not have unchecked exceptions. Please clarify this for my understanding.