Works for me with VS2017 in both debug and release mode.
I'm starting to suspect another bug in the VS2022 compiler like the one recently discovered in wxImage.
https://github.com/wxWidgets/wxWidgets/issues/23164
Could you switch off compiler optimization in the release config and try again?
Visual Studio Debug/Release differences Topic is solved
Re: Visual Studio Debug/Release differences
Use the source, Luke!
-
- Super wx Problem Solver
- Posts: 488
- Joined: Fri Oct 27, 2006 4:35 pm
- Location: Paris, France
- Contact:
Re: Visual Studio Debug/Release differences
I turned off all optimization values in the C++/Optimization panel, with no effect on result.
Below is the command line of C:C++ section of the project properties
/ifcOutput "VCProjectRelease\" /GS /W4 /Gy /Zc:wchar_t /I"D:\wxWidgets-3.2.1/lib/vc_x64_lib/mswu" /I"D:\wxWidgets-3.2.1/include" /I"D:\wxWidgets-3.2.1/contrib/include" /I"C:\Program Files (x86)\Windows Kits\10\include" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" /Zi /Gm- /Od /Fd"VCProjectRelease\vc143.pdb" /Zc:inline /fp:precise /D "NOPCH" /D "WIN32" /D "__WXMSW__" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /MT /FC /Fa"VCProjectRelease\" /EHsc /nologo /Fo"VCProjectRelease\" /Fp"VCProjectRelease\http.pch" /diagnostics:column
Below is the command line of C:C++ section of the project properties
/ifcOutput "VCProjectRelease\" /GS /W4 /Gy /Zc:wchar_t /I"D:\wxWidgets-3.2.1/lib/vc_x64_lib/mswu" /I"D:\wxWidgets-3.2.1/include" /I"D:\wxWidgets-3.2.1/contrib/include" /I"C:\Program Files (x86)\Windows Kits\10\include" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" /I"C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" /Zi /Gm- /Od /Fd"VCProjectRelease\vc143.pdb" /Zc:inline /fp:precise /D "NOPCH" /D "WIN32" /D "__WXMSW__" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /MT /FC /Fa"VCProjectRelease\" /EHsc /nologo /Fo"VCProjectRelease\" /Fp"VCProjectRelease\http.pch" /diagnostics:column
Re: Visual Studio Debug/Release differences
Too bad, that would have been an easy explanation.
Use the source, Luke!
Re: Visual Studio Debug/Release differences
Hi,
Can you try to install MSVC 2017 and build the library and the code with it?
You don't have to uninstall the current one - they can co-exist.
If everything will be successful, we will know its a bug in the compiler
Thank you.
Can you try to install MSVC 2017 and build the library and the code with it?
You don't have to uninstall the current one - they can co-exist.
If everything will be successful, we will know its a bug in the compiler
Thank you.
-
- Super wx Problem Solver
- Posts: 488
- Joined: Fri Oct 27, 2006 4:35 pm
- Location: Paris, France
- Contact:
Re: Visual Studio Debug/Release differences
Had 2019 installed. Rebuilt application with it.
Application finds the file both in Debug and in Release mode.
Application finds the file both in Debug and in Release mode.
Re: Visual Studio Debug/Release differences
Hi,
File a bug with M$ about that.
Thank you.
File a bug with M$ about that.
Thank you.
-
- Super wx Problem Solver
- Posts: 488
- Joined: Fri Oct 27, 2006 4:35 pm
- Location: Paris, France
- Contact:
Re: Visual Studio Debug/Release differences
Bug filed with Visual Studio plateform.
Re: Visual Studio Debug/Release differences
FWIW, I have tested the zipped project with MSVS 2022 Community v17.4.4 using 64-bit build of wxWidgets (recentish master, tested both shared and static builds) on WIndows 10 22H2.
Both Debug and Release builds show "File found" after clicking the button.
I did not use the provided MSVS solution and project (it did not build out of the box), so I just dropped all the files into my template wxWidgets project (see the attachment).
EDIT
BTW, does the error manifest for you only when using that complex project? AFAICT, the relevant code boils down to just this
EDIT 2
I also tried the original project and my code with wxWidgets 3.2.1, both still worked.
Both Debug and Release builds show "File found" after clicking the button.
I did not use the provided MSVS solution and project (it did not build out of the box), so I just dropped all the files into my template wxWidgets project (see the attachment).
EDIT
BTW, does the error manifest for you only when using that complex project? AFAICT, the relevant code boils down to just this
Code: Select all
#include <wx/wx.h>
#include <wx/protocol/http.h>
#include <memory>
class MyApp: public wxApp
{
public:
bool OnInit() override
{
wxHTTP http;
if ( http.Connect("www.pixname.com") )
{
std::unique_ptr<wxInputStream> inStream(http.GetInputStream("/AccountsManager/AccountsManagerLatestVersion"));
if ( inStream )
wxLogMessage("File found.");
else
wxLogError("File not found.");
}
else
wxLogError("Could not connect.");
return false;
}
}; wxIMPLEMENT_APP(MyApp);
I also tried the original project and my code with wxWidgets 3.2.1, both still worked.
- Attachments
-
- http-PB.zip
- (7.42 KiB) Downloaded 108 times
-
- Super wx Problem Solver
- Posts: 488
- Joined: Fri Oct 27, 2006 4:35 pm
- Location: Paris, France
- Contact:
Re: Visual Studio Debug/Release differences
I went over the code in my Http.zip project, and made a curious discovery:
'httpapp.cpp' file contains the following sequence, automatically generated by DialogBlocks for all applications:
if all the #if wxUSE ... #endif are commeneted out, the code works in both Debug and Release modes. If any of these statements is not commented, the Release version fails.
This does not solve the problem in my 'real' application, though.
It does lead one to suspect that there is a problem in code generation.
'httpapp.cpp' file contains the following sequence, automatically generated by DialogBlocks for all applications:
Code: Select all
bool HttpApp::OnInit()
{
////@begin HttpApp initialisation
// Remove the comment markers above and below this block
// to make permanent changes to the code.
#if wxUSE_XPM
wxImage::AddHandler(new wxXPMHandler);
#endif
#if wxUSE_LIBPNG
wxImage::AddHandler(new wxPNGHandler);
#endif
#if wxUSE_LIBJPEG
wxImage::AddHandler(new wxJPEGHandler);
#endif
#if wxUSE_GIF
wxImage::AddHandler(new wxGIFHandler);
#endif
Principal* mainWindow = new Principal( NULL );
mainWindow->Show(true);
////@end HttpApp initialisation
return true;
}
This does not solve the problem in my 'real' application, though.
It does lead one to suspect that there is a problem in code generation.