I have a window which when opening is not firing the Open event. It was but now it is not.
I have even added the breakpoints shown in the image below. The app just runs and misses the breakpoints and does not execute any of the code within the open event.
Perhaps lack of caffeine and sleep I am missing the obvious but what is going on here?
Do me a favor. Restart your computer and see if that fixes the issue. It’s my batshit crazy fix that will sometimes clear up what looks to be crazy stuff like this.
[quote=115918:@Bob Keeney]Well, I don’t know what to tell you. I was working in the Window.Open event just a few minutes ago in a Cocoa app.
Time to shut the computer down and go have a drink, or four, and come back tomorrow?[/quote]
I think it is… Completely baffled by this, never had this issue before and it was firing the open event earlier today. I can’t see how it can not fire. I might just try profiling the code and see if it appears there.
This is a silly question…did you happen to copy frmMain and set its copy to be the default window, so you’re changing code in a window that isn’t actually used?
Right, I have found the issue but I don’t understand why it is causing it. I have a container control instance on the window on which there is a combo box. In the combo box open event I have the following code:
for N as integer = 0 to FontCount
me.AddRow(Font(n))
next N
For whatever reason, if I comment this code out, the open event of the window fires correctly and the methods listed on my image above fire.
Further to this, I realised that I should be iterating through the fonts to FontCount -1 so I changed the above code as such and everything is ok. Very odd that the above mistake would stop the open event firing but continue execution normally.
Quickly verified it - indeed it prevents all Open events, which would be called after the the ComboBox’s Open event (which includes other controls, the ContainerControl itself and the window).
The bug can be verified as follows:
Dim fontName As String = Font(FontCount)
This should give an OutOfBoundsException, but it doesn’t - in the debugger the app just pauses for a second and then continues to run.
Tested on Cocoa with v2014 r2. A test with the RB 2012 shows that the bug was not present at that time.