-
Notifications
You must be signed in to change notification settings - Fork 15.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows does not display Notifications #4973
Comments
I think we're dealing with a regression here, across all Windows versions. I see that @zcbenz fixed something in 0.37.2 to re-enable notifications on OS X and Linux, I'll take a look to see what the bug with Windows is. |
...actually, quick update: You're not the only one reporting this, but after firing up my little matrix over here, I can't reproduce the issue with any of the later Windows 10 builds using both 37.3 and 36.12. Could you ensure that notifications are not disabled? They fail silently if they are. |
Let me try a fresh Windows image tomorrow, maybe we're setting some settings with older versions of electron that are we're not setting in the new ones. In the meantime, could you give an older electron build a try? If it works in 36.10 (or so), we'd know for sure that it's a regression. |
I can confirm that they do work in 0.36.10 and 0.36.11, but not in 0.36.12. So this does indeed seem to be a regression. EDIT: they also do not work in 0.37.1, yet work in 0.37.2, but again not in 0.37.3. |
Can confirm this. Works in older, does not work in newer. |
And just to make things worse, it seems like that running an older version of electron and sending a notification "fixes" the new versions. We're probably not setting something that we used to set - I'll get on it. |
Doing some breakpoint debugging, I have no clue what change is responsible. @zcbenz: Any idea what could have disabled notifications? Maybe any changes around the AppModelId? |
Confirmed here too. 75ec7a0 looks like it might be the cause. Points to electron-archive/brightray@242feb1. |
Nah, that was me - and that checked is passed, but the notification still doesn't display. |
Dug some more, now I think #4805 may be the cause. To test, I cloned the electron-quickstart-app, bumped electron-prebuilt to 0.37.3, and added a |
can confirm this happens on 0.37.3 and 0.37.5.. Also building with and without #4805 confirms the regression is introduced ini the commit.. Ah implementing notification on Windows is so much more complicated than on Mac.. Really appreciate your efforts working on it! |
Quick update: Setting any app user model id does indeed break notifications. However, that is not the case for Electron 0.36, so I assume that there's actually something else going on here. |
So, after hours of debugging: I'm not entirely sure what the actual reason is. Sometimes I get notifications, sometimes I don't. If somebody can reliably reproduce this, I'd love to know all the system details. |
I could never get notification on win 10 with the userAppModelId change. |
Here's a sample app that I can reproduce the issue reliably with: https://gist.github.com/javan/4dd6990cf7756cdff81eca62896bbb98 Tested on a Windows 10 VM from https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/mac/ running in VMWare Fusion. Details:
Run it as-is and Notifications should appear. Then uncomment
I found that after I dropped down to 0.36 and then back up to 0.37, I couldn't reproduce until I changed the appUserModelId string to something different. Seems like Windows liked and remembered whatever 0.36 did and continued to like it on 0.37. Hope this helps! |
One more update: I spent hours (about 20) at this point in ProcMon, ProcExp, and windbg - and I still don't know what the exact root cause of the issue is. The symptom is clear: Once the app user model id is set (and it is set correctly), the app receives However, I do find it interesting that in #4842, breakpoints set with 0.36.x work in 0.37.x, while breakpoints set in 0.37.x do not. I'm sort of expecting that this will be fixed by a seemingly random change somewhere else. @zcbenz @paulcbetts: Any ideas? If anyone has any ideas left, it's probably you two. |
@javan I'm not sure that this repro makes any sense, because you're not launching the executable from a shortcut with an app user model ID set - if you're just running Electron, you shouldn't set your app user model ID |
On Windows 10, you actually don't need the shortcut for notifications. |
@felixrieseberg, thanks for all your time on this! ❤️ Sounds incredibly frustrating to debug. v0.37.0 upgraded to Chrome 49 and Chrome seems to have movement around native notifications. I don't have specific Chrome changes to point to, but I wonder if there's some kind of conflict. For the sake of moving forward, what do you think about scoping the changes in #4805 to Windows < 10 to get notifications working in Win 10 at least? |
Our team checked on different PCs, on some Windows 10 it works, on some - not. On Windows 8/8.1 doesn't work (as worked before) at all. But when we completed the task with Electron v0.37.3 all was fine - so maybe the problem comes with Windows updates as well. As for the recent builds of Windows 10 we got this: Would be glad to help more with it, but don't work with native development for years. |
After biset the commits, I can confirm this is caused by electron-archive/brightray@242feb1. The key of debugging is, make sure you change the AppUserModelID to a new value every time, otherwise Windows itself might be confused and give random results. |
The problem seems to be:
|
Man, thanks a lot. I'll buy you a drink next week. In the meantime, I'll confirm on our machines and then send a PR! |
Hmm I'm wrong here, when using application name as notifier's ID, it is actually telling Windows our AppUserModelID is the application name, which works because it has been used as AppUserModelID by old versions of Electron before. The magic thing is, if we ignore |
@javan @felixrieseberg |
I've been trying to figure out if I'm missing something or anything, but since the docs only state that they "just work" on windows 10 I'm at a loss here. Notifications show fine for osx and linux, just not on windows 10. I can even go into the devtools and type
new Notification("testing", { body: "testing" });
and nothing happens. Do I need to make an installer or do I have to set the application user model id? Or might the packager screw it up?EDIT: I can rule out the packager, just did an npm install with electron-prebuilt 0.37.3 -> ran electron main.js -> created a new notification in devtools and no avail.
I can reproduce this with the electron-quick-start example app using the version set in package.json (^0.36.0) or setting it to 0.37.3.
The text was updated successfully, but these errors were encountered: