|
6 | 6 | import * as nls from 'vs/nls'; |
7 | 7 | import { URI } from 'vs/base/common/uri'; |
8 | 8 | import * as errors from 'vs/base/common/errors'; |
9 | | -import { equals, deepClone, assign } from 'vs/base/common/objects'; |
| 9 | +import { equals, deepClone } from 'vs/base/common/objects'; |
10 | 10 | import * as DOM from 'vs/base/browser/dom'; |
11 | 11 | import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; |
12 | 12 | import { IAction } from 'vs/base/common/actions'; |
13 | 13 | import { IFileService } from 'vs/platform/files/common/files'; |
14 | 14 | import { toResource, IUntitledTextResourceEditorInput, SideBySideEditor, pathsToEditors } from 'vs/workbench/common/editor'; |
15 | 15 | import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService'; |
16 | | -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; |
| 16 | +import { ITelemetryService, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry'; |
17 | 17 | import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IRunKeybindingInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows'; |
18 | 18 | import { ITitleService } from 'vs/workbench/services/title/common/titleService'; |
19 | 19 | import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService'; |
@@ -46,7 +46,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti |
46 | 46 | import { MenubarControl } from '../browser/parts/titlebar/menubarControl'; |
47 | 47 | import { ILabelService } from 'vs/platform/label/common/label'; |
48 | 48 | import { IUpdateService } from 'vs/platform/update/common/update'; |
49 | | -import { IStorageService } from 'vs/platform/storage/common/storage'; |
| 49 | +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; |
50 | 50 | import { IPreferencesService } from '../services/preferences/common/preferences'; |
51 | 51 | import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/node/menubar'; |
52 | 52 | import { withNullAsUndefined, assertIsDefined } from 'vs/base/common/types'; |
@@ -104,7 +104,8 @@ export class NativeWindow extends Disposable { |
104 | 104 | @ITunnelService private readonly tunnelService: ITunnelService, |
105 | 105 | @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, |
106 | 106 | @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, |
107 | | - @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService |
| 107 | + @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService, |
| 108 | + @IStorageService private readonly storageService: IStorageService, |
108 | 109 | ) { |
109 | 110 | super(); |
110 | 111 |
|
@@ -426,8 +427,8 @@ export class NativeWindow extends Disposable { |
426 | 427 | this.updateTouchbarMenu(); |
427 | 428 |
|
428 | 429 | // Crash reporter (if enabled) |
429 | | - if (!this.environmentService.disableCrashReporter && product.crashReporter && product.hockeyApp && this.configurationService.getValue('telemetry.enableCrashReporter')) { |
430 | | - this.setupCrashReporter(product.crashReporter.companyName, product.crashReporter.productName, product.hockeyApp); |
| 430 | + if (!this.environmentService.disableCrashReporter && product.crashReporter && product.appCenter && this.configurationService.getValue('telemetry.enableCrashReporter')) { |
| 431 | + this.setupCrashReporter(product.crashReporter.companyName, product.crashReporter.productName, product.appCenter); |
431 | 432 | } |
432 | 433 | } |
433 | 434 |
|
@@ -540,31 +541,36 @@ export class NativeWindow extends Disposable { |
540 | 541 | } |
541 | 542 | } |
542 | 543 |
|
543 | | - private async setupCrashReporter(companyName: string, productName: string, hockeyAppConfig: typeof product.hockeyApp): Promise<void> { |
544 | | - if (!hockeyAppConfig) { |
| 544 | + private async setupCrashReporter(companyName: string, productName: string, appCenterConfig: typeof product.appCenter): Promise<void> { |
| 545 | + if (!appCenterConfig) { |
545 | 546 | return; |
546 | 547 | } |
547 | 548 |
|
| 549 | + const appCenterURL = isWindows ? appCenterConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] |
| 550 | + : isLinux ? appCenterConfig[`linux-x64`] : appCenterConfig.darwin; |
| 551 | + const info = await this.telemetryService.getTelemetryInfo(); |
| 552 | + const crashReporterId = this.storageService.get(crashReporterIdStorageKey, StorageScope.GLOBAL)!; |
| 553 | + |
548 | 554 | // base options with product info |
549 | 555 | const options: CrashReporterStartOptions = { |
550 | 556 | companyName, |
551 | 557 | productName, |
552 | | - submitURL: isWindows ? hockeyAppConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? hockeyAppConfig[`linux-x64`] : hockeyAppConfig.darwin, |
| 558 | + submitURL: appCenterURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', info.sessionId), |
553 | 559 | extra: { |
554 | 560 | vscode_version: product.version, |
555 | 561 | vscode_commit: product.commit || '' |
556 | 562 | } |
557 | 563 | }; |
558 | 564 |
|
559 | | - // mixin telemetry info |
560 | | - const info = await this.telemetryService.getTelemetryInfo(); |
561 | | - assign(options.extra, { vscode_sessionId: info.sessionId }); |
| 565 | + // start crash reporter in the main process first. |
| 566 | + // On windows crashpad excepts a name pipe for the client to connect, |
| 567 | + // this pipe is created by crash reporter initialization from the main process, |
| 568 | + // changing this order of initialization will cause issues. |
| 569 | + // For more info: https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#normal-registration |
| 570 | + await this.electronService.startCrashReporter(options); |
562 | 571 |
|
563 | 572 | // start crash reporter right here |
564 | 573 | crashReporter.start(deepClone(options)); |
565 | | - |
566 | | - // start crash reporter in the main process |
567 | | - return this.electronService.startCrashReporter(options); |
568 | 574 | } |
569 | 575 |
|
570 | 576 | private onAddFoldersRequest(request: IAddFoldersRequest): void { |
|
0 commit comments