prb28 / vscode-amiga-assembly

Amiga Assembly extension for Visual Studio Code
GNU General Public License v3.0
179 stars 12 forks source link

Cannot read properties of undefined (reading 'on') #291

Closed prb28 closed 3 months ago

prb28 commented 9 months ago

Discussed in https://github.com/prb28/vscode-amiga-assembly/discussions/290

Originally posted by **djyt** February 1, 2024 Hello, Have been enjoying coding with this great extension. However, VSCode just auto updated itself, and now whenever I try to compile and run I receive the cryptic error dialog: Cannot read properties of undefined (reading 'on') Does anyone have any tips as to how to avoid this? ![image](https://github.com/prb28/vscode-amiga-assembly/assets/2414449/3ca0820c-026c-437d-9f79-29ad53181c79)
prb28 commented 9 months ago

@grahambates There are some breaking changes in the last version of vscode.

grahambates commented 9 months ago

Looking at it now 👍

djyt commented 9 months ago

@grahambates Thanks Graham.

Also just wanted to say a massive respect for the work you've done on this project. It's been a real joy to code with - given I've spent many hours working within the framework, I feel I owe you a pint or a coffee!

At some point I'll put together a list of small tweaks and ideas. But as they say, ideas are cheap!

grahambates commented 9 months ago

Bit of a strange one. This was down to chaining calls to process.on():

    process
      .on("unhandledRejection", (reason, p) => {
        logger.error(reason + " Unhandled Rejection at Promise " + p);
      })
      .on("uncaughtException", (err) => {
        logger.error("Uncaught Exception thrown: " + this.errorString(err));
        process.exit(1);
      });

From what I can tell this should be valid across all versions of node, and it looks like it's only a problem when the code has been packed with webpack. Either way, changing it to separate calls fixes the issue.

prb28 commented 9 months ago

I've tried that fix locally yesterday. After it, I had some trouble stepping during debug. Did you try step debugging?

grahambates commented 9 months ago

I did, but I'll do some more thorough testing today.

cobour commented 9 months ago

Same error on macOS after update to VSCode 1.86.0 (1.85.2 worked fine). Please note that I am still stuck using Amiga Assembly v1.8.2 because of issue 283 so I hope there is a chance to fix them both, so I can update to VSCode 1.86.0 soon. Thanks in advance!

prb28 commented 9 months ago

@grahambates thanks, it looks good ! @djyt @cobour I've just published a pre-release, can you try it please ? I think maybe there are some problems with the copper breakpoints, but I need some more testing. (My tests are broken, must fix it too before a release)

cobour commented 9 months ago

@prb28 I will try this evening.

grahambates commented 9 months ago

I think maybe there are some problems with the copper breakpoints

Oh yeah good point, that wouldn't really surprise me as I haven't really tested that. I'll have a look at it too.

cobour commented 9 months ago

Here are my test results:

macOS 14.2.1 (Intel)

VSCode 1.86.0, Amiga Assembly v1.8.7 (pre-release) => no error message, but fs-uae does not start at all (no window does come up, program does not run) VSCode 1.86.0, Amiga Assembly v1.8.6 => error message "Cannot read properties of undefined (reading 'on')", fs-uae does not start (emulator does not come up, program does not run)

VSCode 1.85.2, Amiga Assembly v1.8.7 (pre-release) => Extension version can not be installed VSCode 1.85.2, Amiga Assembly v1.8.6 => error message "[EMU] No suitable emulator binary", fs-uae does not start (emulator does not come up, program does not run) VSCode 1.85.2, Amiga Assembly v1.8.2 => no error message, fs-uae starts, program starts, debugging works

djyt commented 9 months ago

@prb28 Hello - sorry for the delay. Just gave the pre-release a quick test.

Run without debugging -> I can compile and launch in UAE. Start debugging -> causes some kind of crash. I've attached a screenshot.

Also, am I misrembering or has the bundled version of UAE changed with the pre-release version? It's currently 4.10.1

image

image

howprice commented 9 months ago

Hi. Thanks for fixing the build issue. I've updated to v1.8.7 (pre-release) and I'm having the same issue when debugging.

image

prb28 commented 9 months ago

@howprice I do not have it with the example, workspace. Can you please, try to remove the "all exceptions" option ? You have an error opening "demo.asm" file, is that normal ?

look's like https://github.com/prb28/vscode-amiga-assembly/issues/284

prb28 commented 9 months ago

@djyt @howprice can you try this workaround? https://github.com/prb28/vscode-amiga-assembly/issues/284#issuecomment-1925943609

howprice commented 9 months ago

Thanks! Unchecking "All Exceptions" from the Breakpoints section of the Run and Debug pane has allowed the program to be debugged. I think I have had this issue in the past, and unchecked that same option; perhaps the vscode update reset it to checked?

With regards to the issue you mentioned in the previous post, this is an ongoing issue I have with constants. It also occurs when I open the Run and Debug > Variables > Registers > Constants node. Output:

[VASM] Error building c:\GitHub\howprice\Amiga3D\src\demo.asm to get constants. 

fatal error 13: could not open <demo.asm> for input
aborting...
program exited (with status: 1), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)

EDIT: Please let me know if you need a repro and/or any local files for this - I seems to get it in every project.

prb28 commented 9 months ago

@howprice, thanks for the test. Yes you can open a new issue, if you have a minimal project to reproduce the issue it helps a lot !

djyt commented 9 months ago

@djyt @howprice can you try this workaround? #284 (comment)

@prb28 I can confirm from a quick test that unchecking "All Exceptions" has fixed the issue and I can debug. Awesome.

AndyJBuchanan commented 8 months ago

Hello I am trying to set up on a RPi 5 (Latest 64 Bit Pi OS). I'm having an issue here too. I tried installing the 1.1.4 uae-dap and switching to the pre-release Extension. VSCode 1.87.1, Amiga Assembly v1.8.7 (pre) => error message "[EMU] No suitable emulator binary", fs-uae does not start (it is installed and in the PATH [/usr/local/bin] )

prb28 commented 8 months ago

@AndyJBuchanan for a raspberry pi you'll have to rebuild fs-uae. I don't think that the standard build on Ubuntu intel will work.

AndyJBuchanan commented 8 months ago

Should I build any specific fork? The default fs-uae binary from apt seems to run ok from the command line.

AndyJBuchanan commented 8 months ago

The version I've built from the github source (4.0.2-dev) doesn't identify the 'remote_debug" patch in the version string so it's failing the uae-dap launch checks. Do I need an extra patch?

prb28 commented 8 months ago

You'll need to build this : https://github.com/grahambates/fs-uae with the prb28 branch.

AndyJBuchanan commented 8 months ago

Thank you! Needed a bit of fiddling, but I have now so far as I can tell a working remote debug fs-uae and basic debugging functionality in the Extension seems to be working. Now to see if I can build some of my old devpac sources...