I have a Windows CE application that uses WinForms and has worked fine until now. It suddenly, while I was testing, stopped working, and I can't get it to work any more, I get one of those two errors. I have not changed anything that I can see causing them.
Anyway, I tried debugging the application to see where it fails. It fails in the initial form's InitializeComponent().
We have the code:
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.label1);
The Controls.Add line causes the exception. Note that this is generated code, which I have never touched, and I also haven't changed this form or its code behind.
Another thing - when the debugger stops at the guilty LoC, before executing it, panel1.Controls is marked as "Could not evaluate expression" when I view the content of panel1 in the debugger.
Anyone have an idea what this is about?
EDIT: I have 3 applications I test on the device. So I tested all 3. One of them worked fine. Another one threw an error about the .NET framework not being the right version (note - this application worked before, and worked "out of the box" - these are Dolphin devices that can be reset to factory settings, and it used to work with a freshly reset device without this error, and now complained about the .NET framework version). The third one is the app I originally posted about which threw native exceptions.
THEN I took another device. All 3 applications worked on it. Then, I put the "problem" device back in, and now all 3 work on it too? I am confused. I am testing on a device reset to factory settings, so it should be the same every time. I even reset it multiple times earlier, and the problems wouldn't go away. Now they went away by just leaving the device aside for 15 minutes (not even soft-resetting it)??
User contributions licensed under CC BY-SA 3.0