In order to decrease our app's installer size and do not force the user to download MSVC runtime redistributable installer, we include all the MSVC runtime DLLs we need (and only them) into our installer using the following technique.
All was working fine during many years until now. Recently we've switched to use MSVC2022 and 14.42.34433.0
version of the runtime (pretty new one). Now, we're getting crash dumps from our users. Not too much (about 1 per 1000 users) with the following stack trace:
msvcp140.dll!00007ffa1d488c34() Unknown
myapp.exe!std::_Mutex_base::lock() Line 52 C++
myapp.exe!std::unique_lock<std::mutex>::{ctor}(std::mutex &) Line 144 C++
We've analyzed all these reports and found that MSVC runtime DLLs in all these reports are loaded from C:\Windows\System32
folder, not from our app's folder. These runtime DLLs are way too older than the one we use (e.g. 14.28.29910.0
or 14.0.2415.1
). And it seems they are not binary compatible with our app build.
Question: What are the possible reasons of why sometimes these system's DLLs are loaded instead of our app's provided ones?
The culprit is Mozilla Firefox
web browser.
User downloads and launches distributive using this web browser -> installer installs and launch our app -> app is loaded with C++ runtime installed in system instead of the one we provide.
This is not reproducible with other web browsers.
More details are available here.