vscode: vscode.authentication.onDidChangeSessions does not fire for new sessions (1.80 regression?)
Type: Bug
(Note: this could be an API misunderstanding, but then if this is working as expected I’m not sure how to achieve the results I want)
I have a waitForSignIn
method that looks something like:
public async waitForSignIn(): Promise<void> {
if (await this.isSignedIn()) {
return Promise.resolve();
}
return new Promise<void>((resolve) => {
const disposable = vscode.authentication.onDidChangeSessions(async (event) => {
if (event.provider.id === 'microsoft' && await this.isSignedIn()) {
disposable.dispose();
resolve();
}
});
});
}
After calling waitForSignIn
when not signed in, I would expect this method to resolve after, well, signing in.
However, after signing in, what actually happens is…nothing. I have a breakpoint set on the if (event.provider.id === 'microsoft') {
line and it never gets hit.
Elsewhere in the codebase, there’s another onDidChangeSessions listener, and as far as I can tell, it only gets called when I completely log out of a provider (at which point the listener is called twice as many times as the number of extensions that were using the provider).
VS Code version: Code - Insiders 1.80.0-insider (4649b5333370139d161e7b5d4f78ca13741efa35, 2023-06-28T08:01:04.380Z) OS version: Windows_NT x64 10.0.22621 Modes: Remote OS version: Windows_NT x64 10.0.22000 Remote OS version: Windows_NT x64 10.0.22000
System Info
Item | Value |
---|---|
CPUs | 12th Gen Intel® Core™ i5-1235U (12 x 2496) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 7.83GB (0.53GB free) |
Process Argv | –crash-reporter-id 9e2e1591-04a3-4609-91af-028b3f018d5c |
Screen Reader | no |
VM | 0% |
Item | Value |
---|---|
Remote | SSH: wave_analysis |
OS | Windows_NT x64 10.0.22000 |
CPUs | Intel® Xeon® Platinum 8272CL CPU @ 2.60GHz (8 x 2594) |
Memory (System) | 32.00GB (24.73GB free) |
VM | 0% |
Item | Value |
---|---|
Remote | SSH: wave_analysis |
OS | Windows_NT x64 10.0.22000 |
CPUs | Intel® Xeon® Platinum 8272CL CPU @ 2.60GHz (8 x 2594) |
Memory (System) | 32.00GB (24.73GB free) |
VM | 0% |
Extensions (29)
Extension | Author (truncated) | Version |
---|---|---|
vscode-toggle-quotes | Bri | 0.3.6 |
remotehub | Git | 0.58.0 |
wavework | Mic | 1.2023.67002 |
blazorwasm-companion | ms- | 1.1.4 |
vscode-edge-devtools | ms- | 2.1.2 |
remote-containers | ms- | 0.297.0 |
remote-ssh | ms- | 0.102.0 |
remote-ssh-edit | ms- | 0.86.0 |
remote-wsl | ms- | 0.80.2 |
vscode-remote-extensionpack | ms- | 0.24.0 |
azure-repos | ms- | 0.34.0 |
remote-explorer | ms- | 0.4.1 |
remote-repositories | ms- | 0.36.0 |
remote-server | ms- | 1.2.1 |
material-theme | zhu | 3.15.17 |
midl3-language-server | Ale | 0.0.31 |
vscode-eslint | dba | 2.4.2 |
vscode-research | dev | 1.2022.1111005 |
vulnerability-extension | dev | 1.2023.621002 |
prettier-vscode | esb | 9.16.0 |
copilot-chat | Git | 0.3.2023062701 |
copilot-nightly | Git | 1.93.195 |
vscode-azdo-codereview | Mic | 1.2022.722003 |
vscode-nmake-tools | Mic | 4.0.220809006 |
azure-pipelines | ms- | 1.208.0 |
vscode-dotnet-runtime | ms- | 1.6.0 |
sarif-viewer | MS- | 3.3.7 |
azure-account | ms- | 0.11.5 |
cpptools | ms- | 1.16.3 |
(2 theme extensions excluded)
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
py29gd2263:30776702
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
pyind779:30611226
vscrpc:30624061
pythonsymbol12:30651887
2i9eh265:30646982
showlangstatbar:30737417
pythonms35:30671666
03d35959:30757351
ecj1e332:30687743
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30771523
showindicator:30766888
pythongtdpath:30726887
bgfeh915:30769767
gsofa:30778558
e440d664:30776459
welcomedialog:30778555
pythonnosmt12:30773574
pythonidxpt:30768918
pythondjangots:30768917
pythonnoceb:30776497
copilotsettingc:30767685
e537b577:30772214
asynctokenver:30776452
dsvsc013:30777762
dsvsc014:30777825
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (15 by maintainers)
Commits related to this issue
- Fire event when using non-localserver flow Fixes https://github.com/microsoft/vscode/issues/186558 — committed to microsoft/vscode by TylerLeonhardt a year ago
- Fire event when using non-localserver flow (#189493) Fixes https://github.com/microsoft/vscode/issues/186558 — committed to microsoft/vscode by TylerLeonhardt a year ago
🤦 the
_sessionChangeEmitter
only gets fired when wecreateSessionWithLocalServer
… but for remote connections we do thecreateSessionWithoutLocalServer
flow instead.https://github.com/microsoft/vscode/blob/e53e02b64dfcecbeba37b83abdae4dabd675aeeb/extensions/microsoft-authentication/src/AADHelper.ts#L308-L325
easy fix.
Hmm, you’re right. I’ll need to investigate this more and see why I’m seeing something different in our extension.