Skip to content

Add more log information - #111545

Closed
NCC1701M wants to merge 5 commits into
microsoft:masterfrom
NCC1701M:master
Closed

NCC1701M wants to merge 5 commits into
microsoft:masterfrom
NCC1701M:master

Conversation

@NCC1701M

Copy link
Copy Markdown

This PR includes additional logging to get more information on #111177

@bpasero

Copy link
Copy Markdown
Contributor

Why is this needed?

@bpasero Benjamin Pasero (bpasero) added the info-needed Issue requires more information from poster label Dec 1, 2020
@NCC1701M

NCC1701M commented Dec 1, 2020

Copy link
Copy Markdown
Author

To get a closer look if log messages are written because there wasn't any message in the log yesterday. And if log messages are written to see if all messages there or if something is missing which would indicate an error. Maybe it happens in the lambda function and the error doesn't reach the top try...catch. The log messages can be removed as soon as we had an closer look

@bpasero

Copy link
Copy Markdown
Contributor

So has the issue come back to you?

@NCC1701M

NCC1701M commented Dec 2, 2020 •

Copy link
Copy Markdown
Author

Yes, it never left. It has something to do with vscode-remote://dev-container entries in the openedPathsList in the storage.json file. Most likely with dev-containers which I created by using the command Clone Repository in Container Volume

grafik

When I remove those entries from openedPathsList it works as expected. When I add the entries all items from the task bar context menu are gone, except for those which are pinned or those which are not in the list at all.

@bpasero Benjamin Pasero (bpasero) removed the info-needed Issue requires more information from poster label Dec 2, 2020
@NCC1701M

NCC1701M commented Dec 4, 2020

Copy link
Copy Markdown
Author

Benjamin Pasero (@bpasero) When will the changes be available in the insider release?

@bpasero

Copy link
Copy Markdown
Contributor

NCC1701M I don't really understand the purpose of this PR, there is already logging for errors here:

this.logService.warn('updateWindowsJumpList#recentWorkspaces', error); // https://github.com/microsoft/vscode/issues/111177

If there was any exception we would already see it, no?

@NCC1701M

NCC1701M commented Dec 5, 2020

Copy link
Copy Markdown
Author

I don't think so. And this PR is too test if the logging really works. Maybe for some kind of reason something happens and is not logged.

Only because there is logging doesn't mean it is working. What if the update jumplist function isn't called at all? We would never knew because the only logging method is in a catch block which would never be reached because of you don't call the method you never get an error.

If this method is called with the PR we can see it in the log window even though there is no error in this function.

But there is a error, believe me. And the error is pretty annoying.

I would love to simply open the dev tools in VSCode and set a break point in workspacesHistoryMainServices but it is not possible because the file isn't there. Therefore we have to go another way (or even more ways) and one is to extend logging.

@bpasero

Copy link
Copy Markdown
Contributor

NCC1701M can you clarify why the try/catch here is not catching all the cases if there was an error:

try {
if (this.getRecentlyOpened().workspaces.length > 0) {
// The user might have meanwhile removed items from the jump list and we have to respect that
// so we need to update our list of recent paths with the choice of the user to not add them again
// Also: Windows will not show our custom category at all if there is any entry which was removed
// by the user! See https://github.com/microsoft/vscode/issues/15052
let toRemove: URI[] = [];
for (let item of app.getJumpListSettings().removedItems) {
const args = item.args;
if (args) {
const match = /^--(folder|file)-uri\s+"([^"]+)"$/.exec(args);
if (match) {
toRemove.push(URI.parse(match[2]));
}
}
}
this.removeRecentlyOpened(toRemove);
// Add entries
jumpList.push({
type: 'custom',
name: nls.localize('recentFolders', "Recent Workspaces"),
items: arrays.coalesce(this.getRecentlyOpened().workspaces.slice(0, 7 /* limit number of entries here */).map(recent => {
const workspace = isRecentWorkspace(recent) ? recent.workspace : recent.folderUri;
const title = recent.label ? splitName(recent.label).name : this.getSimpleWorkspaceLabel(workspace, this.environmentService.untitledWorkspacesHome);
let description;
let args;
if (isSingleFolderWorkspaceIdentifier(workspace)) {
description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), getPathLabel(dirname(workspace), this.environmentService));
args = `--folder-uri "${workspace.toString()}"`;
} else {
description = nls.localize('workspaceDesc', "{0} {1}", getBaseLabel(workspace.configPath), getPathLabel(dirname(workspace.configPath), this.environmentService));
args = `--file-uri "${workspace.configPath.toString()}"`;
}
return {
type: 'task',
title,
description,
program: process.execPath,
args,
iconPath: 'explorer.exe', // simulate folder icon
iconIndex: 0
};
}))
});
}
} catch (error) {
this.logService.warn('updateWindowsJumpList#recentWorkspaces', error); // https://github.com/microsoft/vscode/issues/111177
}

We assume that there is an exception happening somewhere in that block and if it was, you would get an error logged. Since there is no error logged, your logging would not reveal anything more either, no? For sure this code is triggered, how would it not?

@NCC1701M

NCC1701M commented Dec 5, 2020

Copy link
Copy Markdown
Author

There could be several reasons why there is no error - at least on I have explained.

  • The function might no be called at all, because the error happens in an different error which is not clearly identified as an error regarding to the problem
  • The exception could already be handled in one of the functions which are called in the updateWindowsJumpList function and can also not clearly identified as an error regarding to this problem. There are several function call already in the map function like isRecentWorkspace, splitName, localize only to name a few.
  • I'm not sure about the implementation of arrays.coalesce maybe it simply returns an empty array or something like that.

I've never said that the problem happens in this function. It could be elsewhere in VSCode. I'm only saying that it's not a problem by the window jumplist implementation. Sure Maybe there is an entry which causes the problem but, to handle those errors should be done in VSCode either by ignoring damaged entries or to prevent them to happen.

As I also mentioned before, the problem has something to to with vscode-remote://dev-container entries. Maybe they are to long for jumplist entries or something else, so the problem might also be in the Remote Container extension, but thats not on me to identify. This has to be done by the developers of VSCode and their extensions. And as far as I know. the Remote Container extension is also by microsoft.

I'm just trying to help by adding some additional log information trying to pin point the problem.

@bpasero

Copy link
Copy Markdown
Contributor

NCC1701M I am fine adding more log statements, but then I would suggest to add statements that print out more information from what we have today. The function is called, we know that, because it works for you when have no recent entries with remotes right? So we can rule that out. And if any of the code within would throw an exception, we would also find out about it because we have a global try/catch around it. So I think we can rule out that an exception occurs.

As such, if there is an entry in the jump list that is causing the jump list to be empty, this is likely not a problem with an exception but something where Windows or Electron is not able to create the jump list altogether, but logging inside VSCode will likely not reveal this issue.

I feel the best strategy to push this further is to try to come up with an isolated Electron sample project that sets the jump list with exactly the entries you have when it fails to render. Because then we could report this to Electron (https://github.com/atom/electron).

Does that make sense?

@NCC1701M

NCC1701M commented Dec 5, 2020

Copy link
Copy Markdown
Author

Yeah I'm with you on the log entries with more information and feel free to add more log statements and information to the existing ones.

Sure we can do that with an isolated electron app but before we do this, have you tried to reproduce the problem with the information given? And then tried to debug it VSCode? Or do you have suggestions how I can debug it with the released Code or code-insiders version?

@bpasero

Copy link
Copy Markdown
Contributor

Yeah I tried to reproduce right from the beginning, here is what I did:

  • be on Windows
  • use VSCode to open a folder in WSL (that is a remote connection)
  • verify that these remote folders appear in the recently opened list

See my comment #111177 (comment)

I do not have a docker setup on Windows, so maybe you could try to reproduce with WSL?

@bpasero

Copy link
Copy Markdown
Contributor

NCC1701M in #111177 (comment) you indicated:

The problem seems to be related to remote containers. I've added a vscode-remote://dev-container workspace by hand to the "workspaces3" array of storage.json and then the same problem happens.

Can you give me the exact URL you tried to see if I can reproduce that locally?

@NCC1701M

NCC1701M commented Dec 5, 2020

Copy link
Copy Markdown
Author

I never had a problem with WSL remote connections. The problems are with docker container when I come them in a volume as described above.

I can send you the URL on Monday.

@bpasero

Copy link
Copy Markdown
Contributor

I was able to use Docker on Windows and found the task menu to work even with Docker entries.

@NCC1701M

NCC1701M commented Dec 7, 2020

Copy link
Copy Markdown
Author

I was able to use Docker on Windows and found the task menu to work even with Docker entries.

Did you also used Clone Repository in Container Volume or did you used an existing repo on your disk and opend it in a container? Because the latter works for me as well.

Did you used a GitHub-repo? I used an Repo hosted on Azure DevOps. If you used a GitHub-Repo I'll try this one as well to see if this works for me as well.

@bpasero

Copy link
Copy Markdown
Contributor

I actually selected to open a local folder inside the docker container. Happy to try out another case if you can give me one that reproduces this issue 👍

@NCC1701M

NCC1701M commented Dec 7, 2020

Copy link
Copy Markdown
Author

I actually selected to open a local folder inside the docker container. Happy to try out another case if you can give me one that reproduces this issue 👍

Open a local folder works for me as well. It's the Clone Repository in Container Volume which doesn't work. The URLs created by this function a much longer.

I sent you one example this morning by mail using the address you added to your GitHub profile.

@bpasero

Copy link
Copy Markdown
Contributor

Ok thanks I reopened #111177 for me to try out.

@github-actions github-actions Bot locked and limited conversation to collaborators Jan 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants