StackOverflow Exception, Long time no see


I have not seen a stackoverflow exception for a long time. Today I happened to bump into one in random test code. I will explain how it happened. What the code is used for and why it was written this way are not interesting to me and are not in the scope of this post.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class ChildClass : BaseClass
{
    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            base.Dispose();
            //DO something
        }
    }
}
 
public class BaseClass
{
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
 
    protected virtual void Dispose(bool disposing)
    {
        if (disposing)
        {
            //DO something
        }
    }
}

Please read more at http://paullou.com/2015/10/28/stackoverflow-exception-long-time-no-see/

 
Comments (1)

  1. SimorC says:

    "Look who came to say hi!"

Skip to main content