Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

c# - Function evaluation disabled because a previous function evaluation timed out

I have an C# application in which I am getting this error :

"Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation."

I saw many posts related to this error on stackoverflow and on msdn also but found no solution. Most of the people say that this error comes in multithreaded application and can be resolved by deleting all the breakpoints. In my case, my app is single threaded and I have deleted all the breakpoints also but still I am getting this error when I debug the app. When I run the app. without debugging, my application just hangs and I have to stop it throught visual studio. I tried to find the code where its getting hang and I found the line where it gets hang. Here is the code snippet :

MatchCollection matchesFound = Regex.Matches(content, 
                                             keywordPattern,
                                             RegexOptions.Multiline);
int matchCount = matchesFound.Count;

When execution comes at second line, i.e. when code tries to get the value of Count property my application gets hang. My regular expression is fine as I have tested it in Expresso and I am sure that application is not getting hanged while executing Matches() method. If I come to that line by debugging, I get the above mentioned error. Does anyone knows why this error comes and how to resolve it?

I am using Visual studio 2005.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...