Addon crashes Blender when run from VSCode

I have a weird issue I’m not sure how to handle.

I am in the process of upgrading an addon of mine. Here’s a temporary release for the issue: Gizmo_Tools.zip (3.1 KB)

In short, it adds a few keyboard shortcuts to change the size of the gizmo and operate transforms on objects.

I’m using VSCode with Jacques Lucke’s Blender Development extension to easily update and see the changes in Blender in a couple of clicks.

When I run Blender manually, there doesn’t seem to be any issues. But when I run Blender from VSCode using that extension’s blender start command (which I guess runs Blender in some form of debug mode), while I am able to run the addon’s operators from the menus or the shortcuts, I experience a crash when I open Blender’s preferences.

All the VSC terminal says is the following:

 *  Executing task: c:\AppInstall\Blender\stable\blender-4.2.0-stable.a51f293548ad\blender.exe --python c:\Users\Lauloque\.vscode\extensions\jacqueslucke.blender-development-0.0.21\pythonFiles\launch.py 

Reloading external rigs...
Reloading external metarigs...
installing preset:  default.py
installing preset:  developer.py
installing preset:  modeling.py
installing preset:  none.py
Update armature presets...
noodler_load_post
init
[{'load_dir': 'c:\\Users\\Lauloque\\Documents\\Repositories\\GizmoTools\\Gizmo_Tools', 'module_name': 'Gizmo_Tools'}]
USER ADDON: C:\Users\Lauloque\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons
 * Serving Flask app 'Blender Server'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:7673
Press CTRL+C to quit
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Sending: {'type': 'setup', 'blenderPort': 7673, 'debugpyPort': 8906, 'blenderPath': 'c:\\AppInstall\\Blender\\stable\\blender-4.2.0-stable.a51f293548ad\\blender.exe', 'scriptsFolder': 'c:\\AppInstall\\Blender\\stable\\blender-4.2.0-stable.a51f293548ad\\4.2\\scripts', 'addonPathMappings': [{'src': 'c:\\Users\\Lauloque\\Documents\\Repositories\\GizmoTools\\Gizmo_Tools', 'load': 'C:\\Users\\Lauloque\\AppData\\Roaming\\Blender Foundation\\Blender\\4.2\\scripts\\addons\\Gizmo_Tools'}]}
Waiting for debug client.
Debug client attached.
Error: Failed to read blend file 'D:\library\Models\Vincent.blend': Missing DNA block
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFD267E562A
Module  : python311.dll
Thread  : 00010c78
Writing: C:\Users\Lauloque\AppData\Local\Temp\blender\debug_logs\blender.crash.txt

 *  The terminal process "c:\AppInstall\Blender\stable\blender-4.2.0-stable.a51f293548ad\blender.exe '--python', 'c:\Users\Lauloque\.vscode\extensions\jacqueslucke.blender-development-0.0.21\pythonFiles\launch.py'" terminated with exit code: 11. 
 *  Terminal will be reused by tasks, press any key to close it. 

And here’s the mentioned crash file.
blender.crash.txt (47.8 KB)

It doesn’t seem to mention anything related to my addon.

But since the crash happens when opening the preferences, I tried to comment out the addon’s preference drawing, but it didn’t help.

I tried this on my “work” 4.2 build where I have all my preferences and addons installed, but also on a barebone portable 4.2 build with factory setup, it crashes in both.
I also tried on Blender 3.2 (which was the latest Blender version for which I updated the addon), as well as 4.0, and there I have no crash.

I think that’s because of UI. In 4.2 we got changes in panels - new Extensions tab. So if the addon has some UI in prefs - probablly that’s what crashes Blender.

@L0Lock : I’m experiencing a similar issue on Blender 4.2.1. Are you on that version?

When I launch Blender from VSC and go to the Add-on tab: immediate crash !
That wasn’t the case with Blender 4.2.0 nor 4.1.

Here is the message:

Repository data: z:\EvalSofts\Blender\Versions\blender-4.2.1-SL\portable\extensions\blender_org not found, sync required!
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFB55CC562A
Module  : python311.dll
Thread  : 0000b81c
Writing: C:\Users\JULIEN~1.BLE\AppData\Local\Temp\blender.crash.txt

Note that since this Blender installation is used with VSC, it is a ZIP version that I made “portable” by adding a folder named “portable” in its main directory.
I’m entering a bug issue for this.

Issue reported here:
Crash when clicking on the Add-ons tab in Preferences in 4.2.1 - Blender launched from VSC #127282