<p dir="auto"><strong>OS:</strong>  Windows 10,Windows 7<br>
<strong>Electron Version:</strong>  0.37.4</p>
<p dir="auto">In my renderer process (web page),I am sending a message synchronously for printing the page as PDF.</p>
<p dir="auto">In the callback of <code class="notranslate">window.webContents.printToPDF</code> I am returning the<code class="notranslate">returnValue</code> of event.But the callback is never called.</p>
<p dir="auto">When attempting the same process asynchronously it works fine.</p>
<p dir="auto"><strong>Code:</strong></p>
<p dir="auto"><em>Renderer:</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
var params = {
    &quot;path&quot;: undefined,
    &quot;filename&quot;: vm.profile._id + &quot; &quot; + vm.profile.firstname
}
let result = ipcRenderer.sendSync('print-profile-pdf', params);"><pre class="notranslate"><code class="notranslate">
var params = {
    "path": undefined,
    "filename": vm.profile._id + " " + vm.profile.firstname
}
let result = ipcRenderer.sendSync('print-profile-pdf', params);
</code></pre></div>
<p dir="auto"><em>Main Process:</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
ipcMain.on('print-profile-pdf', function(event, params) {
    printToPdf(params.path, params.filename, event);
});
function printToPdf(path, filename, event) {
    var options = {
        marginsType: 2,
        pageSize: &quot;A4&quot;,
        printBackground: false,
        printSelectionOnly: false,
        landscape: false
    };
    let file = (path || app.getPath(&quot;desktop&quot;)) + &quot;/&quot; + (filename || &quot;profile&quot;) + &quot;.pdf&quot;;
    previewWindow.webContents.printToPDF(options, function(error, data) {
        if (error) {
            logger.error(error);
            event.returnValue = {
                error: error,
                success: false
            };
            throw error;
        }
        fs.writeFile(file, data, function(error) {
            if (error) {
                logger.error(error);
                event.returnValue = {
                    error: error,
                    success: false
                };
                throw error;
            }
            logger.info(&quot;PDF Saved Successfully in &quot; + filename);
            event.returnValue = {
                filename: filename + &quot;.pdf&quot;,
                success: true
            };
        });
    });"><pre class="notranslate"><code class="notranslate">
ipcMain.on('print-profile-pdf', function(event, params) {
    printToPdf(params.path, params.filename, event);
});
function printToPdf(path, filename, event) {
    var options = {
        marginsType: 2,
        pageSize: "A4",
        printBackground: false,
        printSelectionOnly: false,
        landscape: false
    };
    let file = (path || app.getPath("desktop")) + "/" + (filename || "profile") + ".pdf";
    previewWindow.webContents.printToPDF(options, function(error, data) {
        if (error) {
            logger.error(error);
            event.returnValue = {
                error: error,
                success: false
            };
            throw error;
        }
        fs.writeFile(file, data, function(error) {
            if (error) {
                logger.error(error);
                event.returnValue = {
                    error: error,
                    success: false
                };
                throw error;
            }
            logger.info("PDF Saved Successfully in " + filename);
            event.returnValue = {
                filename: filename + ".pdf",
                success: true
            };
        });
    });
</code></pre></div>
<p dir="auto">I was able to duplicate the same issue in a fresh setup too.<br>
<em><strong>Repo:</strong></em> <a href="https://github.com/RaghuChandrasekaran/electron-quick-start">https://github.com/RaghuChandrasekaran/electron-quick-start</a></p>
<p dir="auto"><strong>Reason for sync call:</strong> I don't want to allow the user to intreact until this operation gets successfully executed.</p>
<ul dir="auto">
<li>Electron version: 1.8.2 beta 3 and 4 (ia32 and x64)</li>
<li>Operating system: Windows 10 and Arch Linux</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Devtools work.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Electron crash.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Start electron, open devtools and type anything in console. Electron crash with error (0xC0000005). Unlike <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="247698360" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/10188" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/10188/hovercard" href="https://github.com/electron/electron/issues/10188">#10188</a> no any log was created.</p>