Code just stops... Weirdest problem

cboshdave

Member
Joined
Dec 11, 2014
Messages
24
Programming Experience
1-3
So, I write lots of fairly utilitarian routines for lots of things. Nothing fancy. Today, I ran into the weirdest problem. My code processes just fine down to a certain line, and then, even though the routine continues on, the code just stops like it is the end of the routine. I step thru, same problem. I have changed the next lines to do something different, and it still just stops on the line and shows my form.

It is on a Form_Load. It stops on this line of code shown below. Even if I step it, F10 OR F11, it just displays the form. Like there is a End of method in there somewhere. I have copied the code out, deleted the form_load event and then put it all back in. Same result.


C#:
    comboBoxStatus.SelectedValue = passedInCS.StatusFK;  //This is where the code just stops.  No matter what I put next.
      
    if (1 == 1)
    {
        MessageBox.Show("Here we are.");
    }

I am totally stumped. Not sure where to go with this?? I'm not sure it would be beneficial to see all the code. It would be fairly meaningless without context? Just setting up some combo boxes and setting values.
 
Last edited:
Hmmm... I think I just found it. The value that I am trying to set is null. My object (passedInCS.StatusFK) is null. So, it is bombing out of that and just displaying the form. I guess I am not accustomed to that behavior. I usually get some sort of an error saying it can't be set to null value or something. Especially running in the debugger. Weird. Oh well, i guess it is solved.
 
If an exception is thrown in the Load event handler in a 64-bit app then it is swallowed and execution continues. It's an oddity that results from a difference of opinion between the Windows team and the .NET team at Microsoft that has never been resolved. Once you know about it, it's no big deal but yours is not the first confusion that has resulted when it was first encountered.
 

Latest posts

Back
Top Bottom