title: Why isn't pdb for ntdll.dll cached
body: <p>I'm developing C++ under Visual Studio Community 2013. It is C++/Win32 project not UWP and it is run as Debug/x64 platform.</p>
  
  <p>My config is:</p>
  
  <pre><code>Tools -&gt; Options -&gt; Debugging -&gt; Symbols -&gt; All module, unless excluded
  Tools -&gt; Options -&gt; Debugging -&gt; Symbols -&gt; Cache symbol in this directory 
  </code></pre>
  
  <p>Cache symbol directory contains bunch of <code>*.pdb</code> files and it was never touched.</p>
  
  <p>Problem:
  When I run debugger occasionally I get message about contacting MS symbol server to download <code>ntdll.dll</code> and some other files which are I guess system related because I do not recognize them as a part of my project.</p>
  
  <p>Why is <code>ntdll.dll</code> being downloaded? <a href="https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/05/understanding-symbol-files-and-visual-studios-symbol-settings/" rel="nofollow noreferrer">This</a> article says:</p>
  
  <blockquote>
    <p>Some common reasons symbols aren’t loaded include:</p>
    
    <ol>
    <li>Symbol paths don’t point to the correct location</li>
    <li>The symbol file is from a different version of the module than the one loaded in the process - Visual Studio requires that the symbol file come from the exact same build as the module. It cannot load symbols that come from a different build even if the source code was identical</li>
    </ol>
  </blockquote>
  
  <p>I haven't rebuild <code>ntdll.dll</code>, how could I? It is not possible because it is part of Windows kernel, so why download debug symbols for <code>ntdll.dll</code> again and again instead of caching it?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>When I run debug (F5) then under <code>Debug -&gt; Windows -&gt; Output</code> I see following line:</p>
  
  <pre><code>'MyProject.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Loading disabled by Include/Exclude setting.
  </code></pre>
  
  <p>Output of <code>Debug -&gt; Windows -&gt; Modules</code>:</p>
  
  <pre><code>ntdll.dll   C:\Windows\System32\ntdll.dll   N/A No  Loading disabled by Include/Exclude setting.        2   10.0.14393.447 (rs1_release_inmarket.161102-0100)   11/2/2016 11:13 AM  00007FFFDF410000-00007FFFDF5E1000   [12772] MyProject.exe       
  </code></pre>
  
  <p>As I said it happens occasionally so I do not know how exactly I can reproduce this. Seems that in the past time it is working and <code>ntdll.dll</code> is not downloaded from MS servers anymore. I cannot change x64 to x86 because our project does not run on x86.</p>
  
  <p>My <code>C:\Users\wakatana\AppData\Local\Temp\SymbolCache</code> contains following folders/files (I guess one might be for x86 and another for x64 but I'm not sure):</p>
  
  <pre><code>ntdll.pdb\41C94DD545BD4FCBA2E8F404185B97DC1\ntdll.pdb
  ntdll.pdb\77A5329C3B1E425FAA9519DA285D8DA71\ntdll.pdb
  </code></pre>
  
  <p>Is it possible to explicitly tell VS to use already cached version of <code>ntdll.dll</code> in <code>C:\Users\wakatana\AppData\Local\Temp\SymbolCache</code> for all new projects or what is the default VS behavior?</p>
  
  <p>My OS is Windows10 Home with latest updates</p>