Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Flamefire opened this issue Nov 23, 2022 · 2 comments
Open

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

Flamefire opened this issue Nov 23, 2022 · 2 comments

Comments

@Flamefire
Copy link

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.

Flamefire added a commit to Flamefire/locale that referenced this issue Nov 23, 2022
The Visual Studio 2015 image has a bug with UTF-8 locales:
appveyor/ci#3857
@FeodorFitsner
Copy link
Member

What would be the fix?

@Flamefire
Copy link
Author

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)

Flamefire added a commit to Flamefire/locale that referenced this issue Nov 24, 2022
The Visual Studio 2015 image has a bug with UTF-8 locales:
appveyor/ci#3857
Flamefire added a commit to Flamefire/locale that referenced this issue Nov 25, 2022
The Visual Studio 2015 image has a bug with UTF-8 locales:
appveyor/ci#3857
Flamefire added a commit to Flamefire/locale that referenced this issue Nov 26, 2022
The Visual Studio 2015 image has a bug with UTF-8 locales:
appveyor/ci#3857
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants