Here are the main parts of the program where the exception seems to be concerned.
using System.Drawing;
using Framework.pages;
namespace Framework
{
public partial class MainWindow : Window
{
public string status;
public MainWindow()
{
InitializeComponent(); // Unhandled exception here
InitializeTheme();
activationStep page = new activationStep();
page.loadPage();
}
// etc etc
This is the abstract class
namespace Framework.pages
{
abstract class template : MainWindow
{
public abstract void loadPage();
public abstract void loadTheme();
}
}
This is the activation step class
using System.Windows.Media;
namespace Framework.pages
{
class activationStep : template
{
public override void loadPage()
{
//this.loadTheme();
}
public override void loadTheme()
{
// Default green activation button
//activateButton.Background = (SolidColorBrush)new BrushConverter().ConvertFromString(Framework.theme.darkGreen);
//activateButton.BorderBrush = (SolidColorBrush)new BrushConverter().ConvertFromString(Framework.theme.borderGreen);
// Set form error color to red
//activationFormError.Foreground = System.Windows.Media.Brushes.Red;
}
// etc etc
The thing is if I comment out these two lines from the MainWindow class:
activationStep page = new activationStep();
page.loadPage();
The program runs fine despite the fact that everything within the activationStep class is commented out anyway (even if they aren't commented out too)? I'm just completely clueless as to why I'm getting this particular exception as there definitely doesn't seem to be any intense loops or anything.
-It's worth noting that there really are not many components loaded into the form and it runs smoothly usually.
You're "newing" up an activationStep
, which derives from template
, which in turn derives from MainWindow
, whose constructor creates a new activationStep
... etc, etc.
This loop runs for awhile, and then you get a StackOverflowException
.
You'll need to rethink your design.
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