microsoft / cppwinrt

C++/WinRT
MIT License
1.64k stars 238 forks source link

CppWinRT failed to run test_cpp20.exe on x64 and x86 on release and debug configuration with MSVC on windows #1292

Closed KawasakiNinjaH2R closed 1 year ago

KawasakiNinjaH2R commented 1 year ago

Version

C++/WinRT v2.3.4.5

Summary

CppWinRT failed to run test_cpp20.exe on x64 and x86 on release and debug configuration with MSVC on windows. It can be reproduced on 9e89b5c on master branch. Could you please help me look at this issue?

Environment: X64 Native Tools Command Prompt For VS 2022 Windows SDK: 10.0.22621.0

Reproducible example

1. git clone https://github.com/microsoft/cppwinrt F:\gitP
2. cd F:\gitP\microsoft\cppwinrt
3. devenv /upgrade cppwinrt.sln 2>&1
4. set PATH=F:\tools\cppwinrt\Nuget;%PATH%
5. nuget.exe restore -ConfigFile F:\tools\cppwinrt\Nuget\NuGet.Config cppwinrt.sln 2>&1
6. nuget.exe restore -ConfigFile F:\tools\cppwinrt\Nuget\NuGet.Config natvis\cppwinrtvisualizer.sln 2>&1
7. nuget.exe restore -ConfigFile F:\tools\cppwinrt\Nuget\NuGet.Config test\nuget\NugetTest.sln 2>&1
8. msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:fast_fwd 2>&1
9. msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:cppwinrt 2>&1
10. _build\x64\Debug\cppwinrt.exe -in F:\tools\cppwinrt\WinMetadata -out _build\x64\Debug -verbose 2>&1
11. msbuild /p:Configuration=Debug,Platform=x64,Deployment=Component /p:PlatformToolset=v143 
12. natvis\cppwinrtvisualizer.sln 2>&1
13. msbuild /p:Configuration=Debug,Platform=x64,Deployment=Standalone /p:PlatformToolset=v143 
14. natvis\cppwinrtvisualizer.sln 2>&1
15. msbuild /p:Configuration=Debug,Platform=x64 /p:PlatformToolset=v143 test\nuget\NugetTest.sln 2>&1
16. msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:test\test_cpp20 2>&1
17. cd F:\gitP\microsoft\cppwinrt\_build\x64\Debug
18. test_cpp20.exe 2>&1

Expected behavior

Test pass

Actual behavior


test_cpp20.exe is a Catch v2.13.9 host application.
Run with -? for options

-------------------------------------------------------------------------------
custom_error_logger
-------------------------------------------------------------------------------
F:\gitP\microsoft\cppwinrt\test\test_cpp20\custom_error.cpp(48)
...............................................................................

F:\gitP\microsoft\cppwinrt\test\test_cpp20\custom_error.cpp(70): FAILED:
  REQUIRE( functionNameSv == "FailOnLine15" )
with expansion:
  "void __cdecl `anonymous-namespace'::FailOnLine15(void)"
  ==
  "FailOnLine15"

===============================================================================
test cases:  6 |  5 passed | 1 failed
assertions: 26 | 25 passed | 1 failed

### Additional comments

_No response_
dmachaj commented 1 year ago

I was not able to reproduce this failure. Here is the more minimal steps for what I did:

git pull
git log (HEAD is 737adea24aaa7b4ed639b689ee94d9d3e00f1a00)
git clean -fdx .
<add nuget.exe to path>
nuget restore cppwinrt.sln
msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:fast_fwd 2>&1
msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:cppwinrt 2>&1
_build\x64\Debug\cppwinrt.exe -in "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0" -out _build\x64\Debug -verbose 2>&1
msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln /t:test\test_cpp20 2>&1
_build\x64\Debug\test_cpp20.exe

And the output I get is:

===============================================================================
All tests passed (28 assertions in 6 test cases)

In case it is notable I am using the most recent 22621 Windows SDK and the most recent version of VS2022. The compiler reports the version as such:

Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64
sylveon commented 1 year ago

This is a recent change in VS previews: https://github.com/microsoft/STL/issues/3063

The test will need to be updated to handle this change.

KawasakiNinjaH2R commented 1 year ago

Thank you so much for your help! I got it!