My c# service got an internal .net execution error that points to recursion issue (e.g. stack overflow). The problem is that the service is pretty large, so I am having trouble finding where the recursion actually occurs.
Can someone with massive regex mojo hook me up with a search string that would find what I need?
A classic example of recursionThe factorial of a number is computed as that number times all of the numbers below it up to and including 1. For example, factorial(5) is the same as 5*4*3*2*1 , and factorial(3) is 3*2*1 .
A recursive function always has to say when to stop repeating itself. There should always be two parts to a recursive function: the recursive case and the base case. The recursive case is when the function calls itself. The base case is when the function stops calling itself.
This is an unanswerable question in the general case. Except for the most trivial examples (e.g. a function calling itself directly), there's no way to analyze a program and determine if recursion occurs. You'll just need to start hitting the debugger or other runtime tools.
This is an example of the halting problem.
A recursion is not easy to find in some situations like:
method1() {
method2()
}
method2() {
method1()
}
So a regex probably would not help you to find it unless it's a trivial case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With