0

I get a stackoverflow exception on following commented line.

namespace Football_Manager_WFA
{    
    public partial class Settings : Form
    {
        Color def_bgdColor = SystemColors.Control;
        Color def_fontColor = Color.Black; // ERROR
        static FontFamily fontFamily = FontFamily.GenericSansSerif;
        Font def_fontType = new Font(fontFamily, 8.0f);
    }
}
2
Contributors
2
Replies
6
Views
4 Years
Discussion Span
Last Post by Dino000
1

A StackOverflowException is usually caused by recursive function calls. Try taking a look at the method(s) that instantiate a new instance of the Settings class (or post them here). There is probably something that calls the method again, or another method that ends up calling the method.

If your IDE shows gives you a call stack, post that too. I'm pretty sure Visual Studio won't, and since .NET 2.0, you can't catch it.

0

Thanks. The problem was as you said nmaillet.

I initialized Settings form two times, so just deleted one of them, and it works now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.