App crashes when icon is set after updating to electron 11.2

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • v11.2.0
  • Operating System:
    • macOS 10.15.7
  • Last Known Working Electron version:
    • v11.1.1

Expected Behavior

Application should open when icon is set, if failed to load icon file I expect to get an exception and not SIGSEGV

Actual Behavior

Application is terminated on the BrowserWindow constructor when icon is supplied

To Reproduce

  • Update to electron v11.2
  • Make sure to have the icon property set when creating new instance of BrowserWindow
  • In the example below I used VSCode icon as an example, I’ve also tried to copy the file to the project dir, it has no affect.
    This happens with other icns files so the file itself is not important.
const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({
    icon: "/Applications/Visual Studio Code.app/Contents/Resources/Code.icns", // <-- comment to avoid crash, or use electron 11.1.1
    /**
     * Jan 13 13:44:22  Electron Helper[26232] <Error>: read failed
       Jan 13 13:44:22  Electron Helper[26232] <Error>: SeatbeltExecServer: failed to read buffer length.
       Failed to initialize sandbox.
       /Users/idanwork/Projects/electron-icon/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron exited with signal SIGSEGV
     */
   // icon: `${__dirname}/Code.icns`, // Tried to copy the icon locally, didn't help
  })

  win.loadURL('https://www.electronjs.org/docs/api/browser-window');
}

app.whenReady().then(createWindow)
app.on('window-all-closed', () => app.quit())
app.on('activate', () => BrowserWindow.getAllWindows().length === 0 && createWindow());

package json

{
  "name": "electron-icon",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "run": "electron ."
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^11.2.0"
  }
}

Screenshots

Additional Information

The example assumes you have Visual Studio Code in the Applications folder, you can alter it to use any other icon file.
Reverting the same code to electron v11.1.x works
Error can’t be caught and the application is terminated
I’ve tried using other icon files and put the files in the project dir, the issue persists.

Edited text in comment

2 thoughts on “App crashes when icon is set after updating to electron 11.2