Hi. This is crazy. It started happening in my main project, so I created a tiny sample brand-new project to reproduce it in and sure enough.. It does NOT happen in a sample project I created that is only a Win32 console app.
I'm running this on Win7x64, if that matters. VS2008 SP1.
Here goes. I create a small dialog app with a button. Put a breakpoint in the handler function for that button. The button handler function looks like this:
void CTestProjectDlg::OnBnClickedButton1()
{
int i;
i = 2; // < breakpoint here
i = 3;
}
Click the button, hit the breakpoint. F10 to step, and boom: "First-chance exception at 0x0398f77b in TestProject.exe: 0xC0000005: Access violation."
It gives me the option to Break or Continue. If I Continue, it just hits it again, only not "First Chance". Yes I have that exception checked in the Debug->Exceptions dlg.
If I Break, the call stack just shows me the line where the breakpoint is. If I F10 again.. I get the exception again, only now the callstack shows me in the _AfxDispatchCmdMsg() function, and my original OnBnClickedButton1() is not in the callstack anymore.
It doesn't matter where I put the breakpoint.
If, instead of F10, I just continue with F5, it works normally.
Now.. if I build a Release version and run in debugging mode: I hit the breakpoint, and all the pointers, variable values look normal. F10, and these turn to garbage. The this pointer is now zero. The m_csHello is now
However, in Release mode, an exception is not caught, and it all runs fine. The "hello World string gets displayed in the dialog box as it should.
I have put in an inquiry to see if some patch was installed on my box by the IT dept in the last day or two. This wasn't happening 2 days ago.
What do you think? Is VS2008 corrupted?
Thanks.
Edit: Additional Information. This does not happen if I build/debug the x64 platform. Only for Win32.
I also took a look at all of the hotfixes/security updates for VS2008 on the box. They are
Finally, I put the project on a different machine that has not been updated for the past 2-3 weeks. It works find on there, and it has these same VS updates installed.
I have also altered the code that is being stepped over for the purpose of this post. .. It is a simple integer assignment, no MFC involved.
At the moment I am in the middle of re-installing VS2008.