<p dir="auto">Hi, I'm trying to use <em>getAllDisplays()</em> API under Windows and I have a very strange behaviour.</p>
<p dir="auto">Code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const screen = require('electron').screen
const arr = screen.getAllDisplays()
console.log(arr)"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">screen</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">screen</span>
<span class="pl-k">const</span> <span class="pl-s1">arr</span> <span class="pl-c1">=</span> <span class="pl-s1">screen</span><span class="pl-kos">.</span><span class="pl-en">getAllDisplays</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">Use case:</p>
<ol dir="auto">
<li>Start the electron app</li>
<li>Call the above code</li>
<li>I get the monitor array in the output</li>
<li>I change the resolution/disable external monitor/etc</li>
<li>I re run the code of above (<strong>without relaunching</strong> the electron app)</li>
<li>I obtain the same output of the point 3), nothing changed. (in some case I get duplicate monitors)</li>
</ol>
<p dir="auto">Under OSX there's no problem.<br>
I guess this problem is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="111205513" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/3075" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/3075/hovercard" href="https://github.com/electron/electron/issues/3075">#3075</a>.</p>
<p dir="auto">In conclusion, work with the screen API under Windows is basically impossible.</p>
<ul dir="auto">
<li>Electron version: 0.37.4</li>
<li>Operating system: Windows</li>
</ul>
<h3 dir="auto">Preflight Checklist</h3>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>5.0.x</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Windows</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>4.2.6</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">The PE "time date stamp" compiled into electron.exe is the ~"unix epoch timestamp" when electron was compiled (specifically, when the .exe was generated by the compiler/linker).</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Starting in Electron 5.0.0-beta.1 and to latest 5.x, the PE timestamp embedded in the electron.exe final build output seems to be some kind of pre-generated number, possibly based on my checkout date (when doing custom builds)? It seems that the latest 4.x build (4.2.6) might work correctly, so this maybe was introduced in 5.x. I have no idea if it's due to chrome or electron build system specifically?</p>
<p dir="auto">Here is a partial list of some historical builds I had on my machine (some also come from official electron builds). Pay special attention to the more recent builds' timestamps:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="E.g., for /F %i in ('dir electron.exe/a/s/b') do @dumpbin /headers %i | findstr /C:&quot;time date stamp&quot; &amp;&amp; echo %i

        56AC4993 time date stamp Fri Jan 29 21:26:43 2016  electron-0.36.7\electron.exe
        57F60AB8 time date stamp Thu Oct  6 01:26:32 2016  electron143\electron.exe

        58753971 time date stamp Tue Jan 10 11:43:45 2017  electron1414\electron.exe
        58878D77 time date stamp Tue Jan 24 09:23:03 2017  electron150\electron.exe
        5898AEF2 time date stamp Mon Feb  6 09:14:26 2017  electron151\electron.exe
        58992869 time date stamp Mon Feb  6 17:52:41 2017  electron160\electron.exe
        58DEADD3 time date stamp Fri Mar 31 12:28:19 2017  electron165\electron.exe
        5939BCEF time date stamp Thu Jun  8 14:09:03 2017  electron173\electron.exe
        59DE5A37 time date stamp Wed Oct 11 10:51:51 2017  electron1615\electron.exe
        5A21F071 time date stamp Fri Dec  1 16:14:41 2017  electron1823\electron.exe
        5A21F078 time date stamp Fri Dec  1 16:14:48 2017  e182\electron.exe

        5A665B0A time date stamp Mon Jan 22 13:43:38 2018  electron1711\electron.exe
        5A66A39B time date stamp Mon Jan 22 18:53:15 2018  electron1824\electron.exe
        5A7213D6 time date stamp Wed Jan 31 11:07:02 2018  electron1825\electron.exe
        5A722031 time date stamp Wed Jan 31 11:59:45 2018  electron1712\electron.exe
        5A7A2A0A time date stamp Tue Feb  6 14:19:54 2018  electron182-release\electron.exe
        5ABAAD0C time date stamp Tue Mar 27 13:43:56 2018  electron200\electron.exe
        5BDB4BCC time date stamp Thu Nov  1 11:54:04 2018  electron306\electron.exe
        5BF32835 time date stamp Mon Nov 19 13:16:37 2018  electron3010-64\electron.exe
        5BFE35B4 time date stamp Tue Nov 27 22:29:08 2018  electron3010-32\electron.exe
        5C1B39D3 time date stamp Wed Dec 19 22:42:27 2018  e3013-32\electron.exe
        5C1B8D30 time date stamp Thu Dec 20 04:38:08 2018  e3013-64\electron.exe
        5C1BED9A time date stamp Thu Dec 20 11:29:30 2018  e400\electron.exe

        5C342E50 time date stamp Mon Jan  7 21:00:00 2019  e500-b1\electron.exe
        5C61F745 time date stamp Mon Feb 11 14:29:25 2019  e3015-64-rc.1\electron.exe
        5C737650 time date stamp Sun Feb 24 21:00:00 2019  e500-b4\electron.exe
        5C82EFC5 time date stamp Fri Mar  8 14:42:13 2019  e3016-32-rc.1\electron.exe
        5C832872 time date stamp Fri Mar  8 18:44:02 2019  e3016-64-rc.1\electron.exe
        5C91C8D0 time date stamp Tue Mar 19 22:00:00 2019  e500-b6\electron.exe
        5C931A50 time date stamp Wed Mar 20 22:00:00 2019  e5-old\electron.exe
        5C9B0350 time date stamp Tue Mar 26 22:00:00 2019  e500-b7\electron.exe
        5CB6B2D0 time date stamp Tue Apr 16 22:00:00 2019  e5-64\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.1\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.2\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.3\electron.exe

        5CC684D0 time date stamp Sun Apr 28 22:00:00 2019  e5-32-working\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-32-rc.1\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.1\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.2\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.3\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.5\electron.exe
        5D12FBD0 time date stamp Tue Jun 25 22:00:00 2019  electron506\electron.exe
        5D1A879B time date stamp Mon Jul  1 15:22:19 2019  e426\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506-32\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506-64\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506\electron.exe
        5D241F50 time date stamp Mon Jul  8 22:00:00 2019  e506b-64\electron.exe"><pre class="notranslate"><code class="notranslate">E.g., for /F %i in ('dir electron.exe/a/s/b') do @dumpbin /headers %i | findstr /C:"time date stamp" &amp;&amp; echo %i

        56AC4993 time date stamp Fri Jan 29 21:26:43 2016  electron-0.36.7\electron.exe
        57F60AB8 time date stamp Thu Oct  6 01:26:32 2016  electron143\electron.exe

        58753971 time date stamp Tue Jan 10 11:43:45 2017  electron1414\electron.exe
        58878D77 time date stamp Tue Jan 24 09:23:03 2017  electron150\electron.exe
        5898AEF2 time date stamp Mon Feb  6 09:14:26 2017  electron151\electron.exe
        58992869 time date stamp Mon Feb  6 17:52:41 2017  electron160\electron.exe
        58DEADD3 time date stamp Fri Mar 31 12:28:19 2017  electron165\electron.exe
        5939BCEF time date stamp Thu Jun  8 14:09:03 2017  electron173\electron.exe
        59DE5A37 time date stamp Wed Oct 11 10:51:51 2017  electron1615\electron.exe
        5A21F071 time date stamp Fri Dec  1 16:14:41 2017  electron1823\electron.exe
        5A21F078 time date stamp Fri Dec  1 16:14:48 2017  e182\electron.exe

        5A665B0A time date stamp Mon Jan 22 13:43:38 2018  electron1711\electron.exe
        5A66A39B time date stamp Mon Jan 22 18:53:15 2018  electron1824\electron.exe
        5A7213D6 time date stamp Wed Jan 31 11:07:02 2018  electron1825\electron.exe
        5A722031 time date stamp Wed Jan 31 11:59:45 2018  electron1712\electron.exe
        5A7A2A0A time date stamp Tue Feb  6 14:19:54 2018  electron182-release\electron.exe
        5ABAAD0C time date stamp Tue Mar 27 13:43:56 2018  electron200\electron.exe
        5BDB4BCC time date stamp Thu Nov  1 11:54:04 2018  electron306\electron.exe
        5BF32835 time date stamp Mon Nov 19 13:16:37 2018  electron3010-64\electron.exe
        5BFE35B4 time date stamp Tue Nov 27 22:29:08 2018  electron3010-32\electron.exe
        5C1B39D3 time date stamp Wed Dec 19 22:42:27 2018  e3013-32\electron.exe
        5C1B8D30 time date stamp Thu Dec 20 04:38:08 2018  e3013-64\electron.exe
        5C1BED9A time date stamp Thu Dec 20 11:29:30 2018  e400\electron.exe

        5C342E50 time date stamp Mon Jan  7 21:00:00 2019  e500-b1\electron.exe
        5C61F745 time date stamp Mon Feb 11 14:29:25 2019  e3015-64-rc.1\electron.exe
        5C737650 time date stamp Sun Feb 24 21:00:00 2019  e500-b4\electron.exe
        5C82EFC5 time date stamp Fri Mar  8 14:42:13 2019  e3016-32-rc.1\electron.exe
        5C832872 time date stamp Fri Mar  8 18:44:02 2019  e3016-64-rc.1\electron.exe
        5C91C8D0 time date stamp Tue Mar 19 22:00:00 2019  e500-b6\electron.exe
        5C931A50 time date stamp Wed Mar 20 22:00:00 2019  e5-old\electron.exe
        5C9B0350 time date stamp Tue Mar 26 22:00:00 2019  e500-b7\electron.exe
        5CB6B2D0 time date stamp Tue Apr 16 22:00:00 2019  e5-64\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.1\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.2\electron.exe
        5CC53350 time date stamp Sat Apr 27 22:00:00 2019  e500-64-rc.3\electron.exe

        5CC684D0 time date stamp Sun Apr 28 22:00:00 2019  e5-32-working\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-32-rc.1\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.1\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.2\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.3\electron.exe
        5CE4D750 time date stamp Tue May 21 22:00:00 2019  e502-64-rc.5\electron.exe
        5D12FBD0 time date stamp Tue Jun 25 22:00:00 2019  electron506\electron.exe
        5D1A879B time date stamp Mon Jul  1 15:22:19 2019  e426\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506-32\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506-64\electron.exe
        5D22CDD0 time date stamp Sun Jul  7 22:00:00 2019  e506\electron.exe
        5D241F50 time date stamp Mon Jul  8 22:00:00 2019  e506b-64\electron.exe
</code></pre></div>
<p dir="auto">Strangely, all the electron 5 builds have a "time" of exactly 22:00:00 (except outside DST where it has 21:00:00). The dates vary from build to build. HOWEVER, if I check out a build, build it, then a week later make changes and rebuild the same checkout, the date stays the same. For example, all the e500 and e502 builds above have the same date. This is despite:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="05/31/2019  11:14 AM        99,663,168 e502-64-rc.1\electron.exe
06/06/2019  03:32 PM        99,663,168 e502-64-rc.2\electron.exe
06/06/2019  04:27 PM        99,663,168 e502-64-rc.3\electron.exe
06/13/2019  03:49 PM        99,663,680 e502-64-rc.5\electron.exe"><pre class="notranslate"><code class="notranslate">05/31/2019  11:14 AM        99,663,168 e502-64-rc.1\electron.exe
06/06/2019  03:32 PM        99,663,168 e502-64-rc.2\electron.exe
06/06/2019  04:27 PM        99,663,168 e502-64-rc.3\electron.exe
06/13/2019  03:49 PM        99,663,680 e502-64-rc.5\electron.exe
</code></pre></div>
<p dir="auto">The actual compile time being very different (over a couple weeks). It seems that when I update the exe, it reuses some old pre-generated timestamp. Additionally, if I delete electron.exe and rebuild, I still get the old timestamp (not sure if incremental linking would be a thing there, but at the very least, deleting just the .exe was not enough to produce a new build timestamp).</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Check out and build Electron 5 on Windows. Observe that the PE timestamp (dumpbin /headers) has an exact minute/second of 00:00, which is weird. If you wait a day or longer, and rebuild, the time/date stamp will be identical, even though the day has changed.</p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto">Why this is important to us: When we build Electron, we store symbols for each build of Electron so that we can investigate crash dumps and the like. In Windows, symbols/dumps use the PE image timedatestamp+sizeofimage as a "key" to uniquely identify every build. .dmp files specifically include this key so that debuggers can find the correct .exe/.dll and from there find the associated .pdb file. Because of this issue, the "key" is no longer unique and is being reused between Electron builds. This causes our PE symbol store to be overwritten with the wrong files and so older PDB files become orphaned and unusable. End result: This means we can't properly debug crashes.</p>
<p dir="auto">We also prefer if possible to not do a full checkout+rebuild of Electron (as that takes a significant amount of time) and we're usually rebuilding due to fixing bugs/security issues (small changes that are very fast to make and recompile). Also, if we do more than one build in a day (since the build timestamps seem to be quantized to "day"), then we get trashed symbols even if we do have separate clean checkouts.</p>