kbilsted / NotepadPlusPlusPluginPack.Net

.Net package to install into visual studio to make plugins for Notepad++
Apache License 2.0
164 stars 52 forks source link

Template: .dll crashes on startup when removing myDockableDialog #103

Closed ewoelkers closed 1 year ago

ewoelkers commented 1 year ago

Disclaimer: I'm a beginner.

Environment:

VS 2019 Community v16.11.22, | Npp x64 v8.4.7 | NppPlugin Release v0.95.0.0 | Windows 10

Context:

I've successfully added the template and have my plugin working. The tool replaces nHibernate SQL query parameters with their values and copies to clipboard for an executable SQL query in SSMS. However, now I'd like to remove the MyDockableDialog that comes with the template.

Issue:

When removing the call for myDockableDialog ( PluginBase.SetCommand(1, "MyDockableDialog", myDockableDialog); ), I'm getting this error on Npp startup: .dll just crashed in notify(SCNotification *notification): with nmhdr.code value of 1002. I've traced this back to NPPN_TBMODIFICATION (documentation here: LINK), but cannot seem to figure out why and how that notification is being triggered.

Request:

Looking for some clarity on how to go about removing MyDockableDialog without causing the plugin to crash on startup. At this point I thought I'd removed any related logic that might be leaving an open call/request, but haven't had any luck. Any guidance would be appreciated

Thanks!

ewoelkers commented 1 year ago

Turns out I think I was just missing declaring idMyDlg so I did that with the id corresponding to my plugin's SetCommand index and that seemed to work.

The issue was when I commented-out the SetCommand line for myDockableDialog I also commented out idMyDlg in the same line, which was needed in the Main.SetToolBarIcon SendMessage command that was called when the NPPN_TBMODIFICATION notification was received in UnmanagedExports.cs