I created a new C++ MFC MDI Application in Visual Studio.
FIRST PROBLEM -
The exception An invalid handle was specified
is thrown when launching it in Debug/Release (x86 only).
Here is my config. :
- Visual Studio Pro 2015 Version 14.0.25431.01 Update 3
- Windows 10 Version 1809 (OS Build 17763.292)
- .NET Framework Version 4.7.03190
- Visual C++ Redistributable installed (2005, 2008, 2010, 2012, 2013, 2015)
Pressing "Break" : Without Microsoft Symbol Servers, it shows something went wrong in C:\Windows\SysWOW64\ntdll.dll
. With Microsoft Symbol Servers, it just shows "Source Not Available".
Pressing "Continue" one or two times : Launches the application, which can be used normally.
When exiting the app by clicking on the dialog "X" button, an Access violation reading location
is also thrown in ntdll.dll. This exception is thrown in (x86) AND (x64).
I tested it on 3 others PCs running Windows 10 (older version) and the same thing happens. I tested it on 2 PCs running Windows 7 and there is no problem.
EDIT - Please see the two following screenshots for the call stack after each of these exceptions are thrown.
Callstack for Invalid Handle Exception when launching the app
Callstack for Access Violation Exception when exiting the app
SECOND PROBLEM - The values of initialized variables are randomly wrong.
For example, I have seen this in a base class constructor :
variable = 0; // int
The debugger shows me that variable
value is 52685
. Not sure if it is a coincidence but the ID of the VC++ 2015 Redistributable Update 3 is 52685 (see URL param).
Microsoft Visual C++ 2015 Redistributable Update 3 / id=52685
The output of variable
in the console shows the correct value (0).
I would appreciate to have some help to resolve this issue as it makes debugging really hard. The only thing I am sure is that it is related to Windows 10.
EDIT - Please see the two following screenshots of variables values while debugging. In the first one, you can see that all "int" variables have the value -842150451 (which should be 0 instead, right?). These variables are declared in the private section of a class. The second screenshot shows the default constructor of this class. One of these "int" (image_bpp) shows the value 52685 instead of the assigned 0. If I switch the initialization of image_bpp and image_pixel_color, then it is the image_pixel_color that shows the wrong value.
Looks like I am not the first one with this issue. I forgot to mention that I am using a simple inheritance (instanciating a derived class, then the constructor of the base class is called and this is where I put my breakpoint).
See this link for reference : Compiler bug with derived classes