Main form's OnLoad override never gets called
The following problem has me s开发者_JAVA百科tumped: I have a WinForms application which used to work just fine. On Windows7 however, my MainForm's "Load"-event handler is never invoked. I tried Googleing a bit and found suggestions for checking if the Event was correctly connected to the handler (it was), and secondly to try overriding the OnLoad method. The OnLoad override was called once (i think, have been debugging substantially) and then no further. Why is the OnLoad override not called? And what could i try in order to fix this?
Best regards!
I think I solved it!
This turned out to have nothing to do with the OnLoad-event in particular. Instead it was caused by code inside the OnLoad event-handler, which uses a 32-bit DLL from a 64-bit context. I found a solution for this on bytes.com/topic/c-sharp/answers/...
The confusing bit was, that the 32-bit/64-bit problem caused an exception immediately when entering the event-handler, so a breakpoint immediately inside the event-handler was never hit. I did'nt get an pop-up with the exception either, because the application has a 'CurrentDomain_UnhandledException'-handler... but thats a different story.
精彩评论