'Visual Studio 2019 'DLL Initialization Failed' - I can't run the app
I was using VS2019 very well until yesterday. Today, when I run my c++ program with F5 or Ctrl-F5, I received error messagebox. And I have next debug message.
'cpp.exe' (Win32): Loaded 'C:\Users\user\source\repos\learn\x64\Debug\cpp.exe'. Symbols loaded.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'cpp.exe' (Win32): Unloaded 'C:\Windows\System32\KernelBase.dll'
'cpp.exe' (Win32): Unloaded 'C:\Windows\System32\kernel32.dll'
The thread 0x2a54 has exited with code 3221225794 (0xc0000142).
The program '[13484] cpp.exe' has exited with code 3221225794 (0xc0000142) 'DLL Initialization Failed'.
Sometimes, it works with next debug messages.
'cpp.exe' (Win32): Loaded
'C:\Users\user\source\repos\learn\x64\Debug\cpp.exe'. Symbols loaded.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
The thread 0x2e88 has exited with code 0 (0x0).
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'.
'cpp.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'.
The thread 0x477c has exited with code 0 (0x0).
The thread 0x335c has exited with code 0 (0x0).
The program '[17728] cpp.exe' has exited with code 0 (0x0).
I think there's something wrong with loading vcruntime*.dll but I don't know what to do.
The wired thing is it works sometimes.
Any advise will be highly appreciated.
Solution 1:[1]
Is your app (cpp.exe) built as 32 or 64-bit? Are you using LoadLibrary in your app? Are you linking to a specific library? You may have a problem with a 64-bit program trying to load a 32-bit library or vice versa. It would be much easier to resolve your issue if you could send a code that replicates this problem.
Solution 2:[2]
I'm having the same problem as you and haven't found the cause yet. My solution is that if you can find the process named VsDebugConsole.exe in Task Manager, close it and debug again. If not found then Close visual studio completely and reopen it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JohnCz |
| Solution 2 | Peter Csala |
