Visual Studio 2022 / Visual C++ cannot find ucrtbased.dll 10.0.19041.789 source code. How to get source code?

Ash9 21 Reputation points
2022-08-26T17:53:30.933+00:00

Both Visual Studio 2022 Community and Enterprise (I tried both) do not automatically find ucrtbased.dll version 10.0.19041.789 source code. I get numerous prompts for files, saying they are not matching those used to build the ucrtbased.dll.

This happens for other cases too... for example, VS was trying to load xlocale header file but it prompted me for its location. A header with that name is located in this folder...

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include

...but that folder is specified in my Solution's Debug Source Files folder... but I nevertheless had to enter it in the prompt box manually. After doing that, VS tells me the file does not match the one used to build the module.

It seems Visual Studio 2022 does not ship with the source code matching the PDBs which are used for debugging the various CRT/UCRT modules, and that VS (even Enterprise) does not instruct where to find the true source code.

Does anyone happen to know where the runtime source code is?

I could not find it on github or anywhere and the source shipping with VS does not match as mentioned. This throws off what should be an otherwise powerful flowing debugging experience.

Thanks,
Ash

Developer technologies Visual Studio Debugging
Developer technologies C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ash9 21 Reputation points
    2022-08-26T18:55:11.75+00:00

    Here is another example. The module is msvcp140d.dll and the function is put... when the module was built, put started on line 514 which is within a different function in the source code that ships with Visual Studio 2022 Enterprise.

    Source file loaded by debugger:
    C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\ostream

    Developer experience while using debugger:
    235342-image.png

    Debugger wants source files for 14.32.31332.0 (you can see above that VS 2022 Ent installs 14.33.31629):
    235296-image.png

    235230-image.png

    VS 2022 Ent installs source for 14.33.31629 but OS has msvcp140d.dll 14.32.31332.0... VS Ent does not prompt or indicate where I can get updated source for the updated runtime.

    Does anyone know where the drops of latest runtime source code are located? I could not find anything from cursory searches, nothing on Microsoft's github account, still trying, hoping someone knows.

    Thanks,
    Ash

    0 comments No comments

  2. Castorix31 90,681 Reputation points
    2022-08-27T07:37:45.41+00:00

    If I use for example the SDK 10.0.19041.0 (from sdk-archive),
    I have the source in
    C:\Program Files (x86)\Windows Kits\10\Source\10.0.19041.0\ucrt

    For example, if I debug abs function, it goes to :

    C:\Program Files (x86)\Windows Kits\10\Source\10.0.19041.0\ucrt\stdlib\abs.cpp

    //  
    // abs.cpp  
    //  
    //      Copyright (c) Microsoft Corporation. All rights reserved.  
    //  
    // Defines abs() and _abs64(), which compute the absolute value of a number.  
    //  
    #include <stdlib.h>  
      
      
      
    #pragma function(abs, _abs64)  
      
      
      
    extern "C" int __cdecl abs(int const number)  
    {  
        return number >= 0 ? number : -number;  
    }  
      
    extern "C" __int64 __cdecl _abs64(__int64 const number)  
    {  
        return number >= 0 ? number : -number;  
    }  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.