appveyor / ci

AppVeyor community support repository
https://www.appveyor.com
344 stars 64 forks source link

Assertion failure with UTF-8 locales on `Visual Studio 2015` image #3857

Open Flamefire opened 1 year ago

Flamefire commented 1 year ago

One of my build configurations fails with

f:\dd\vctools\crt\crtw32\stdcpp\xmbtowc.c(89) : Assertion failed: ploc->_Mbcurmax == 1 || ploc->_Mbcurmax == 2

I'm using the Visual Studio 2015 image and compiling using msvc-14.0 aka "Visual Studio 2015"

The issue is a bug in ucrtbased.dll which was seemingly introduced with Visual Studio 2017 15.7.1 that occurs when common encodings such as UTF-8 are used in std::locale (C++)

I don't know how that (faulty) DLL from VS 2017 ended up on the 2015 image but it seemingly is in C:\Windows\System32 (according to the linked issue), so it needs to be fixed in the image itself.

It seems to be worth fixing the image as by default the assertion will cause a message box to be shown which cannot be dismissed and hence blocks the whole job until it times out.

FeodorFitsner commented 1 year ago

What would be the fix?

Flamefire commented 1 year ago

What would be the fix?

I'm not sure, but see the linked bug report. As mentioned I do not know how that DLL ended up on the VS 2015 image, so I don't know the "real" fix. BUT:

The only workaround is to grab ucrtbased.dll from Windows 10 SDK 10.0.16299.0 (f.i., from "C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86\ucrt"), and place it in the directory with your application. In this case UTF-8 codepages won't be supported, but the annoying ASSERT will go away...

and

This issue has been fixed and is now available in our latest update. You can download the update via the in-product notification or from here: https://visualstudio.microsoft.com/vs/ Thanks to all who provided feedback and votes for this problem.

So depending on where the DLL came from installing an OS or VS update may help.
Or installing the mentioned Windows SDK and making sure it's ucrtbased.dll is picked up instead of the system one (or replacing the system DLL with the one from the SDK)