oleg-shilo / cs-script.npp

CS-Script (C# Intellisense) plugin for Notepad++ (x86/x64)
MIT License
246 stars 52 forks source link

got alert in notepad++ 7.5.7 #20

Closed davidsmithgf closed 6 years ago

davidsmithgf commented 6 years ago

got following alert dialog every time startup the notepad++ if installed cs-script(version 1.7.12.0).

This ANSI plugin is not compatible with your Unicode Notepad++. CSScriptNpp.dll is not compatible with the current version of Notepad++. Do you wnat to remove this plugin from the plugins directory to prevent this message from the next lunch? [Yes(Y)] [No(N)]

oleg-shilo commented 6 years ago

Can you please indicate how you installed the plugin. Was it via your "Plugin Managed x64"? Manually? Via plugin's own updater?

oleg-shilo commented 6 years ago

In any case you can fix the broken installation by manually copying the files from the release https://github.com/oleg-shilo/cs-script.npp/releases/tag/v1.7.12.0 into the 'plugins' directory.

Just follow the instructions https://github.com/oleg-shilo/cs-script.npp/wiki/Manual-Installation

davidsmithgf commented 6 years ago
  1. I just install x86 version of notepad++ from the installer here: https://notepad-plus-plus.org/repository/7.x/7.5.7/npp.7.5.7.Installer.exe
  2. Then I just unzip the file: https://github.com/oleg-shilo/cs-script.npp/releases/download/v1.7.12.0/CSScriptNpp.1.7.12.0.x86.zip, put the file CSScriptNpp.x86.dll & the folder CSScriptNpp into C:\Notepad++\plugins\ where I installed notepad++
  3. If I lauch the notepad++, it may popup the alert dialog.
davidsmithgf commented 6 years ago

Also, I tried upzip with 7z and winrar, seems no any difference.

oleg-shilo commented 6 years ago
  1. I have checked, the latest version of Notepad++ (x86) that it can be in-place updated is v7.5.6. image Thus I am not sure about that v7.5.7 installer that you have used.

  2. The install actions you have described are absolutely correct. Even the fact that you opted to use 7z is a good sign. WiZip and WinRar are horribly failing for downloading assemblies.

I have tested yesterday and today all two setups (x86 and x64) with both manual and the plugin built-in update. And manual install for x86 right now. All works just fine. Thus I am completely puzzled.

The only difference between my and your test is that you have your N++ in the non default location.

You may have a look at the %Environment.SpecialFolder.ApplicationData%\Notepad++\plugins\logs\CSScriptNpp\last_startup_error.txt file. I may give you a clue.

If this does not help i suggest you install the previous version v1.7.11.0 via plugin manager, And only after that you may let the plugin to update itself via AboutBox "update" button. sdon't have

davidsmithgf commented 6 years ago

I think it maybe something changed in npp 7.5.7. I've tried uninstall & install again, no problem with 7.5.6. But always got error message even if update via plugin manager: default And I found not last_startup_error.txt but only app.txt write previous version. in app.txt: 2018-03-03T18:15:53|00013360|Debug|CSScriptNpp.Bootstrapper.ConnectPlugins|Plugin has been loaded 2018-03-03T19:42:59|00010772|Debug|CSScriptNpp.Bootstrapper.ConnectPlugins|Plugin has been loaded

oleg-shilo commented 6 years ago

OK, I just noticed the problem. Yes it is something strange with npp 7.5.7.

This is the plugin file structure: on Notepad++ x86

├── plugins
│   ├── CSScriptNpp.x86.dll
│   ├── CSScriptNpp
│   │   ├── CSScriptNpp.dll
│   │   ├── <other files>

on Notepad++ x64

├── plugins
│   ├── CSScriptNpp.x64.dll
│   ├── CSScriptNpp
│   │   ├── CSScriptNpp.dll
│   │   ├── <other files>

The file CSScriptNpp.x*.dll is the plugin native dll, which is to be loaded by the Notepad++ CPU specific host. This dll is build specifically for that notepad CPU type.

However CSScriptNpp.dll and other files in the 'CSScriptNpp' folder are the .NET assemblies. They are the same for both x86 and x64 plugin packages. Being managed assemblies CSScriptNpp.dll cannot be loaded/ hosted as a plugin dll. That's why it is moved further down to the plugin specific folder so N++ does not try to load it and loads CSScriptNpp.x*.dll from the 'plugins' folder instead.

Now... The message box clearly indicates that N++ it truing to load CSScriptNpp.x*.dll instead of CSScriptNpp.x86.dll. This is wrong and loading it is guaranteed to fail.

This means that it is either you have made a mistake when extracted the 7z file or N++ has dramatically changed the way the plugins are loaded. I prefer you being wrong :) It's easy to fix...

davidsmithgf commented 6 years ago

Yes, you're right. I changed the file name plugins\CSScriptNpp.x86.dll -> plugins\CSScriptNpp.dll, the alert disappear.

oleg-shilo commented 6 years ago

I am not following... The name must be "plugins\CSScriptNpp.x86.dll". Can you please provide the exact file structure that you have for the working solution.

I just need to confirm as it looks like N++ has changed the hosting model. A shocker!!!

davidsmithgf commented 6 years ago

I just unzip the file https://github.com/oleg-shilo/cs-script.npp/releases/download/v1.7.12.0/CSScriptNpp.1.7.12.0.x86.zip to plugins, and rename one of the file:

├── plugins │ ├── CSScriptNpp.x86.dll -->CSScriptNpp.dll │ ├── CSScriptNpp │ │ ├── CSScriptNpp.dll │ │ ├── .....

No alert any more.

oleg-shilo commented 6 years ago

Great. Thank you. It is the N++ problem as the v7.5.7 has introduced breaking changes in the plugin loading/probing algorithm.

It's supposed to be backwards compatible but apparently it's not. And I just have been in discussion with the PluginManager team and they also also confirm that the changes are affecting them as well.