Bohn
Bohn

Reputation: 26919

Debug the StackOverFlow exception

When I run my C# program it throws an Stack Overflow exception in one of the methods on a DLL that I have a reference to it in my solution. but no debugging info is available to me because it says it is an stack overflow exception and no info is available. what are the next debugging steps that I should follow to understand what is going on and why ?

thanks

Edit: here is the code that stops at:

static public Collection SortCollection(Collection oCollection, string sPropertyName, string sKeyPropertyName)
{ 
    return SortCollection(oCollection, sPropertyName, sKeyPropertyName); 
} 

Upvotes: 3

Views: 1945

Answers (3)

Tim Ridgely
Tim Ridgely

Reputation: 2420

Looking at your code, the method SortCollection just keeps calling itself over and over. That will create an infinite loop.

You need to do something inside the function to make it eventually stop calling itself, like Andrey says in his comment.

Upvotes: 3

Andy White
Andy White

Reputation: 88355

You could try downloading .NET Reflector Pro. .NET Reflector (the base product) allows you to "decompile" .NET assemblies, giving you the ability to view the source code.

.NET Reflector Pro takes it one step further and allows you to debug through the source code of any arbitrary .NET assembly.

Pro is not free, but there is a short trial period.

http://www.red-gate.com/products/reflector/

Upvotes: 1

Andrey
Andrey

Reputation: 60065

In 99% cases root cause is infinite recursion.

Upvotes: 10

Related Questions