Here's a non-standard idea:
Are accounts declared as List<Account> ?
I am wondering if Accounts property declared as something other than List<Account> - for example, as IList<Account> - and you have a static helper class somewhere with a Sort extension method that is not Correct. This may try to use the List<T>.Sort when the parameter passed is List<T> , but do this without performing the necessary cast to List<T> , resulting in a guaranteed StackOverflowException .
I mean it. Suppose Account is a property of some class that looks something like this:
public class AccountManager { public IList<Account> Accounts { get; private set; } public AccountManager() {
And then suppose you have this static class elsewhere using the Sort extension method:
public static class ListHelper { public static void Sort<T>(this IList<T> list, Comparison<T> comparison) {
In this case, you sent a StackOverflowException code.
Original answer:
Perhaps Accounts is an object of a custom collection class whose Sort method calls itself?
public class AccountCollection : IEnumerable<Account> { // ... public void Sort(Comparison<Account> comparison) { Sort(comparison); // infinite recursion } // ... }
Perhaps the AccountId property calls itself?
public class Account {
Dan tao
source share