I am getting a StackOverflowException when debugging my c# array declaration, which goes like this:
public class ConfigClass : MainWindow
{
private const int totalIndex = 3;
public int[][][] Config = new int[totalIndex][][]
{
new int[1][]
{
new int[] {10, 5, 5, 5, 1, 4},
},
new int[9][]
{
new int[] {4, 3, 1, 4, 2},
new int[] {4, 8, 6, 7, 5},
new int[] {2, 2, 4},
new int[] {2, 2, 4},
new int[] {0, 2, 2, 2, 2, 2, 2, 2, 2},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
},
new int[9][]
{
new int[] {4, 1, 2, 3, 4},
new int[] {4, 5, 6, 7, 8},
new int[] {2, 2, 4},
new int[] {2, 2, 4},
new int[] {0, 3, 3, 3, 3, 3, 3, 3, 3},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0},
},
};
}
public partial class MainWindow : Window
{
ConfigClass Core = new ConfigClass();
public DateTime systemDateTime = new DateTime();
public static class ReferenceTo
{
// for group
public const int group_A = 0;
public const int group_B = 1;
public const int group_C = 2;
public const int group_D = 3;
}
public MainWindow()
{
InitializeComponent();
StartSecondTimer();
}
public void UpdateTime()
{
label_systemTime.Content = systemDateTime.ToLongTimeString();
label_systemDate.Content = systemDateTime.ToLongDateString();
}
public void StartSecondTimer() // start one second timebase
{
DispatcherTimer secondTimer = new DispatcherTimer();
secondTimer.Tick += new EventHandler(dispatcherSecond_Tick);
secondTimer.Interval = new TimeSpan(0, 0, 1);
secondTimer.Start();
}
private void dispatcherSecond_Tick(object sender, EventArgs e) // one second timebase event handler
{
systemDateTime = DateTime.Now;
UpdateTime();
}
}
It is saying I have might have infinite loop or infinite recursion. What am I missing here?
Thanks! :)
EDIT: I added the 'public class ConfigClass : MainWindow' which is the source of the error.
MainWindowis broken. Can you please tell us and show us the exact line that throws the exception? That is - when your debugger breaks, show us the line it's stuck onpublic int[][][] Config = new int[totalIndex][][]declaration, but here's where it stuck atMainWindow:ConfigClass core = new ConfigClass();