<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>
 unknown
</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>
 Windows 10 (2004)
</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>
 unknown
</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
 
<p dir="auto">Rendering does not change.</p>
<h3 dir="auto">Actual Behavior</h3>
 
<p dir="auto">Dots bleed out over time from various elements until state is changed (mouseover/highlight/...)</p>
<h3 dir="auto">To Reproduce</h3>

<p dir="auto">Open electron app and wait. Reliably happens on Slack, VSCode, GitHub Desktop</p>



<h3 dir="auto">Screenshots</h3>

<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/23281537/86516975-6a04fa80-be25-11ea-8266-1e5255537dcc.png"><img src="https://user-images.githubusercontent.com/23281537/86516975-6a04fa80-be25-11ea-8266-1e5255537dcc.png" alt="Code_2020-07-04_18-06-20" style="max-width: 100%;"></a></p>
<h3 dir="auto">Additional Information</h3>
<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>
<p dir="auto">The screen capture event is calling in every 5 minutes by using the <code class="notranslate">setInterval</code> method and its working good in case of "unlock-screen" in window 10, however, when the window screen is locked(Window+L), the below exception has generated.</p>
<blockquote>
<p dir="auto">sources.map is not a function at Desktopcapture.handlEmitOnCapture</p>
</blockquote>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>
v6.0.7
</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>

</li>
</ul>
</li>
</ul>
<p dir="auto">Windows 10 Pro(1803)</p>
<ul dir="auto">
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>

</li>
</ul>
</li>
</ul>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto"><code class="notranslate">Desktopcapture.getSources(optinal,callback)</code> does not handle "lock-screen" nor handlling uncaughtException. Below exception is generating.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/11939820/66304685-6b97a580-e91b-11e9-842a-c95ee67ba6fe.png"><img src="https://user-images.githubusercontent.com/11939820/66304685-6b97a580-e91b-11e9-842a-c95ee67ba6fe.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Expected Behavior</h3>

<p dir="auto"><code class="notranslate">Desktopcapture.getSources(optinal,callback)</code> should handle "lock-screen" / handles uncaughtException.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Step 1: Copy below code</p>
<p dir="auto">const electron = require('electron');</p>
<p dir="auto">const desktopCapturer = electron.desktopCapturer;<br>
const remote = electron.remote;<br>
const electronScreen = remote.screen;</p>
<p dir="auto">const fs = require('fs');<br>
const path = require('path');<br>
const os = require('os');</p>
<p dir="auto">var screenShotPath = '';</p>
<p dir="auto">let getScreenCapture = function () {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const timeoutScheduled = Date.now();
const thumbSize = determineScreenshot();
console.log(thumbSize.height);
console.log(thumbSize.width);
let options = { types: ['screen'], thumbnailSize: thumbSize };

desktopCapturer.getSources(options, function (error, sources) {
    if (error) {
        console.log(error.message);
        return; 
    }
    sources.forEach(function (source) {
        screenShotPath = path.join(os.tmpdir, 'screenshot_' + timeoutScheduled + '.jpeg');
        console.log(screenShotPath);
        fs.writeFile(screenShotPath, source.thumbnail.toPNG(), function (err) {
            if (err) return console.log(err.message);

        });

    });

});"><pre class="notranslate"><code class="notranslate">const timeoutScheduled = Date.now();
const thumbSize = determineScreenshot();
console.log(thumbSize.height);
console.log(thumbSize.width);
let options = { types: ['screen'], thumbnailSize: thumbSize };

desktopCapturer.getSources(options, function (error, sources) {
    if (error) {
        console.log(error.message);
        return; 
    }
    sources.forEach(function (source) {
        screenShotPath = path.join(os.tmpdir, 'screenshot_' + timeoutScheduled + '.jpeg');
        console.log(screenShotPath);
        fs.writeFile(screenShotPath, source.thumbnail.toPNG(), function (err) {
            if (err) return console.log(err.message);

        });

    });

});
</code></pre></div>
<p dir="auto">}<br>
setInterval(function () {<br>
getScreenCapture();<br>
console.log('Captured');<br>
}, 5000);</p>
<p dir="auto">function determineScreenshot() {<br>
const screensize = electronScreen.getPrimaryDisplay().workAreaSize;</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const maxDimension = Math.max(screensize.width, screensize.height);
console.log(maxDimension);

return {
    width: maxDimension * window.devicePixelRatio,
    height: maxDimension * window.devicePixelRatio
};"><pre class="notranslate"><code class="notranslate">const maxDimension = Math.max(screensize.width, screensize.height);
console.log(maxDimension);

return {
    width: maxDimension * window.devicePixelRatio,
    height: maxDimension * window.devicePixelRatio
};
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">Step 2: Install npm &amp; run this code.</p>
<p dir="auto">Step 3: Lock your window screen (Window + L). Lock your screen at least 10 minutes.</p>
<p dir="auto">Step 4: Unlock your widow screen and see the Dialog box popups with the below error message.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/11939820/66305518-18265700-e91d-11e9-8336-8dc91cca7136.jpg"><img src="https://user-images.githubusercontent.com/11939820/66305518-18265700-e91d-11e9-8336-8dc91cca7136.jpg" alt="error" style="max-width: 100%;"></a></p>



<h3 dir="auto">Screenshots</h3>

<h3 dir="auto">Additional Information</h3>
<p dir="auto">Also other errors logs in the terminal</p>
<p dir="auto">[19164:1007/163453.079:ERROR:dxgi_output_duplicator.cc(170)] Failed to capture frame, error 000001EB5A7F5380, code -2005270490<br>
[19164:1007/163453.095:ERROR:screen_capturer_win_directx.cc(140)] DxgiDuplicatorController failed to capture desktop, error code Duplication failed<br>
[19164:1007/163528.058:ERROR:dxgi_output_duplicator.cc(170)] Failed to capture frame, error 000001EB5A871850, code -2005270490<br>
[19164:1007/163528.552:ERROR:screen_capturer_win_directx.cc(140)] DxgiDuplicatorController failed to capture desktop, error code Duplication failed<br>
[19164:1007/163538.072:ERROR:dxgi_output_duplicator.cc(170)] Failed to capture frame, error 000001EB5A878A70, code -2005270490<br>
[19164:1007/163538.077:ERROR:screen_capturer_win_directx.cc(140)] DxgiDuplicatorController failed to capture desktop, error code Duplication failed<br>
[19164:1007/163543.058:ERROR:dxgi_output_duplicator.cc(170)] Failed to capture frame, error 000001EB5A878A70, code -2005270490<br>
[19164:1007/163543.061:ERROR:screen_capturer_win_directx.cc(140)] DxgiDuplicatorController failed to capture desktop, error code Duplication failed<br>
There was an uncaught error TypeError: sources.map is not a function<br>
at DesktopCapturer.handlEmitOnCapturer (~\node_modules\electron\dist\resources\electron.asar\browser\desktop-capturer.js:72:32)</p>