Skip to content

Command 'Remote-Containers: Open Folder in Container...' results in an error (Cannot read property 'forceNewWindow' of null) #111898

Closed

Description

Found while testing microsoft/vscode-remote-release#1817

  1. Clone https://github.com/Microsoft/vscode-remote-try-dotnetcore and open it in VSCode
  2. Run the command "Remote-Containers: Open Folder in Container..." and select the folder

Screen Shot 2020-12-03 at 4 41 39 PM

Activity

  1. chrmarti commented on Dec 4, 2020

    @chrmarti
    Collaborator

    Alexandru Dima (@alexdima) I pass undefined as the second argument to the vscode.openFolder command and that ends up being null on the renderer side (that then slips past a default initializer for a function argument). I didn't immediately see any recent changes in the messaging code, do you have any idea what might be going on?

  2. alexdima commented on Dec 4, 2020

    @alexdima
    Member

    I think the rpc protocol is fine, since I had the same bug a while ago. It has a unit test in place for that here so I do not think that has regressed.

    Johannes Rieken (@jrieken) I think the command arguments serialization might suffer from the undefined becomes null problem. IIRC this happened for the rpc protocol when using JSON.parse(JSON.stringify([0,undefined,2])) which becomes [0,null,2]

  3. jrieken commented on Dec 4, 2020

    @jrieken
    Contributor

    What has changes is that some commands are now registered in the renderer and invoked with slightly different argument structured (I believe is was a single object before). Adding Benjamin Pasero (@bpasero) because API commands should be somewhat graceful.

    Also back to Alexandru Dima (@alexdima) because I do see this as an IPC issue. We are calling this with undefined and receiving null.

    Screenshot 2020-12-04 at 17 15 10

    Screenshot 2020-12-04 at 17 17 01

  4. alexdima commented on Dec 4, 2020

    @alexdima
    Member

    Johannes Rieken (@jrieken) The rpc layer does not recurse into arguments. It behaves the same as with sending other special types, like VSBuffer. So you can send top level undefined arguments, but not undefined deeply nested in the value of an argument.

    So for example:

    • $myMethod(1, undefined, 10) will arrive as $myMethod(1, undefined, 10)
    • but $myMethod(1, [1, undefined, 2], 10) will arrive as $myMethod(1, JSON.parse(JSON.stringify([1, undefined, 2])), 10).

    I am sorry, but there is nothing I can do on my side because I call JSON.stringify on each argument (except for undefined and VSBuffer arguments) and I don't want to reimplement JSON.stringify and JSON.parse for perf reasons. The contract is that your data arrives on the other side via JSON, plus the extra stuff I did on top that I do give top level undefined arguments as undefined and top level VSBuffer as VSBuffer. But I cannot walk into objects, we had that and removed it because it was slowing everything down.

  5. jrieken commented on Dec 4, 2020

    @jrieken
    Contributor

    Makes sense. I didn't expect you to tackle this and generally I try to be defensive wrt undefined/null when they come via RPC. Leaving this to Benjamin Pasero (@bpasero) to more graceful

  6. added
    regression
    candidate
    on Dec 4, 2020
  7. added 2 commits that reference this issue on Dec 5, 2020
    cffc8ea
    40719a0
  8. added 2 commits that reference this issue on Dec 7, 2020
    30e0c57
    04b9a57
  9. locked and limited conversation to collaborators on Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apicandidateregression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions