Skip to content
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

Funky event order (active before start) #31589

Closed
jrieken opened this issue Jul 27, 2017 · 6 comments
Closed

Funky event order (active before start) #31589

jrieken opened this issue Jul 27, 2017 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster verification-found Issue verification failed
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Jul 27, 2017

testing #31475

Have an extension with listener as shown below. Debug a node.js app that just interval's forever and notice the following order of events. Weird is that CUSTOM EVENT comes first (tho not always) and that CHANGE ACTIVE comes before START

CUSTOM EVENT a07ab282-ca16-437c-be61-8637ecc0fb6d scriptLoaded
CUSTOM EVENT a07ab282-ca16-437c-be61-8637ecc0fb6d scriptLoaded
CHANGE ACTIVE a07ab282-ca16-437c-be61-8637ecc0fb6d
START a07ab282-ca16-437c-be61-8637ecc0fb6d
CUSTOM EVENT a07ab282-ca16-437c-be61-8637ecc0fb6d scriptLoaded
CUSTOM EVENT a07ab282-ca16-437c-be61-8637ecc0fb6d scriptLoaded
CUSTOM EVENT a07ab282-ca16-437c-be61-8637ecc0fb6d scriptLoaded
STOP a07ab282-ca16-437c-be61-8637ecc0fb6d
    vscode.debug.onDidStartDebugSession(e => {
        console.log('START', e.id);
    })

    vscode.debug.onDidTerminateDebugSession(e => {
        console.log('STOP', e.id);
    })

    vscode.debug.onDidChangeActiveDebugSession(e => {
        console.log('CHANGE ACTIVE', e.id);
    })

    vscode.debug.onDidReceiveDebugSessionCustomEvent(e => {
        console.log('CUSTOM EVENT', e.session.id, e.event);
    })
@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jul 27, 2017
@weinand
Copy link
Contributor

weinand commented Jul 27, 2017

  • Before we know that the debug session is up-and-running, some scripts have already been loaded. So it will be difficult to have custom events always come after START.
  • but CHANGE ACTIVE should not come before START, that's something we can fix.

@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Jul 27, 2017
@weinand weinand removed their assignment Jul 27, 2017
@isidorn isidorn modified the milestones: July 2017, August 2017 Jul 28, 2017
@isidorn isidorn closed this as completed in 501bd0d Aug 5, 2017
@jrieken
Copy link
Member Author

jrieken commented Aug 29, 2017

@weinand This is what I am seeing now. The order seems correct, but the start and active event seem to be send twice...

START 4909af9c-79ae-4367-96cb-eacb5fde16d6
CHANGE ACTIVE 4909af9c-79ae-4367-96cb-eacb5fde16d6
START 4909af9c-79ae-4367-96cb-eacb5fde16d6
CHANGE ACTIVE 4909af9c-79ae-4367-96cb-eacb5fde16d6
CUSTOM EVENT 4909af9c-79ae-4367-96cb-eacb5fde16d6 script
CUSTOM EVENT 4909af9c-79ae-4367-96cb-eacb5fde16d6 scriptLoaded

@jrieken jrieken reopened this Aug 29, 2017
@jrieken jrieken added the verification-found Issue verification failed label Aug 29, 2017
@isidorn
Copy link
Contributor

isidorn commented Aug 31, 2017

@jrieken I can not repro this.
I am using mac, here's my extension.ts. Let me know what you are doing differently

'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

    // Use the console to output diagnostic information (console.log) and errors (console.error)
    // This line of code will only be executed once when your extension is activated
    console.log('Congratulations, your extension "tsext-first" is now active!');

    // The command has been defined in the package.json file
    // Now provide the implementation of the command with  registerCommand
    // The commandId parameter must match the command field in package.json
    vscode.debug.onDidStartDebugSession(e => {
        console.log('START', e.id);
    })

    vscode.debug.onDidTerminateDebugSession(e => {
        console.log('STOP', e.id);
    })

    vscode.debug.onDidChangeActiveDebugSession(e => {
        console.log('CHANGE ACTIVE', e.id);
    })

    vscode.debug.onDidReceiveDebugSessionCustomEvent(e => {
        console.log('CUSTOM EVENT', e.session.id, e.event);
    })



    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        // The code you place here will be executed every time your command is executed
        const configuration = vscode.workspace.getConfiguration('testExtension', vscode.window.activeTextEditor.document.uri);
        configuration.get('resourceConfiguration');
        console.log(configuration.inspect('resourceConfiguration'));
        console.log(configuration.inspect('resourceConfiguration'));
        // Display a message box to the user
        vscode.window.showInformationMessage('Hello World!');

    });

    context.subscriptions.push(disposable);
}

// this method is called when your extension is deactivated
export function deactivate() {
}

Here's a js program that I am debugging

function fib(i) {
    if (i < 2) {
        for(var t = 0; t < 10; t++) {
            console.log(t);
        }
        return 1;
    }

    return fib(i - 1) + fib(i - 2);
}

console.log(fib(20));

@isidorn isidorn added the info-needed Issue requires more information from poster label Aug 31, 2017
@isidorn isidorn modified the milestones: September 2017, August 2017 Aug 31, 2017
@vscodebot vscodebot bot closed this as completed Sep 7, 2017
@vscodebot
Copy link

vscodebot bot commented Sep 7, 2017

This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.

@roblourens
Copy link
Member

Should this have been closed?

@roblourens roblourens reopened this Sep 27, 2017
@isidorn isidorn modified the milestones: September 2017, Backlog Sep 28, 2017
@vscodebot vscodebot bot closed this as completed Oct 5, 2017
@vscodebot
Copy link

vscodebot bot commented Oct 5, 2017

This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster verification-found Issue verification failed
Projects
None yet
Development

No branches or pull requests

4 participants