+1  A: 

The reasons of the hang and of this error message are probably the same: there is something that takes a lot of time to compute. Both when you do it in code and in debugger. Debugger has no magic power to calculate something faster than your app.

You can try to use Debug.WriteLine to output actual content and keywordPattern. I think it easily might be that both are big enough to take ages to proceed.

iPhone beginner
hmm.. ok.. The reason behind I said that my regex is fine is that, Regex.Matches() method executes without taking too much time. my app. hangs only when I try to get the count property of MatchCollection object.Anyways, I will recheck my regex once more and I will also put sample regex here.Thanks for help !!
Shekhar
`Regeex.Matches()` does almost nothing. `MatchCollection` contents is **lazy** calculated. It is first call to something like `Count` that makes it find all matches. So there are no surprises here. I still think that `content` is big and `keywordPattern` is complicated. You might have to rethink your logic. Maybe there is a way to calculate what you need in much faster way. Actually "How to calculate something efficiently? might be better question to ask here than "Why my program runs so slowly?".
iPhone beginner