oleg-shilo / cs-script.npp

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

64 bit compatibility #6

Closed josuelopezv closed 6 years ago

josuelopezv commented 7 years ago

Hi can you add 64 bit compatibility so I can run it with 64 bit edition of Notepad ++

oleg-shilo commented 7 years ago

It's a difficult one.

N++ only in the infant state of x64 support. But the biggest problem is that N++ design did not follow the mainstream extensibility approach and instead of portable, CPU-neutral plugin hosting (e.g. in Sublime, VSCode) opted to the native hosting. It is a regrettable decision but it is what it is.

N++ hosting model is a cause of the head ache for many plugin developers. Thus in order for an existing plugin to work on x64 it needs to be reworked or at least rebuild. In result, many plugins are not ported at all. Many will never be, because some wonderful plugins are simple completed/sealed and authors have no plans to revisit them.

In case as CS-Script.Npp it's even trickier. The plugin is still evolving but it relies on the N++ interop bridge that was created quite some time ago by @UFO. That interop is no longer supported and obviously noone is going to create its x64 version so .NET plugins can be repackaged.

I have found an active fork of that interop (https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) that supposed to support x64. I will give it a try when I prepare a new CS-Script release (in a month or so) but there is no warranty for it to work.

Bare in mind x64 isn't yet a main stream N++ edition. N++ team hasn't even ported PluginManager so no wander devs do not rush to port their plugins. Even if they do there is no way to deliver them to the user except manual install, like it was when N++ was only created.

chcg commented 6 years ago

see alpha https://github.com/oleg-shilo/cs-script.npp/releases/download/alpha-v1.7.7.1/CSScriptNpp.x64.7z

@oleg-shilo Could you provide the alpha also as normal zip file to add it to x64 pluginmanager for testing of the installation.

oleg-shilo commented 6 years ago

Done: https://github.com/oleg-shilo/cs-script.npp/releases/tag/beta-v1.7.7.2

I would indeed appreciate if you can check it with the x64 pluginmanager.

The beta-release does not have its own updater.exe ready yet but plugin itself should be OK. Though Roslyn may still give a nasty 5-9 seconds delay on firsts script execution.

Please let me know the outcome of your testing.

Thank you, Oleg

chcg commented 6 years ago

@oleg-shilo Added with https://github.com/bruderstein/npp-plugins-x64/commit/a36a044d9a2f34512fd0e1cd73e15688620353f7, installation seems to be ok apart from assembly version information which is 1.0.0.0 for CSScriptNpp.x64.dll instead of 1.7.7.2. So each time it is shown that there is an update available from 1.0.0.0 -> 1.7.7.2, see https://github.com/oleg-shilo/cs-script.npp/blob/master/src/NppPlugin.Host/Properties/AssemblyInfo.cs

oleg-shilo commented 6 years ago

Excellent. Thank you very much.

  1. I wasn't aware that the plugin manager takes the version from the binary file instead of reading it form the package description. It does create some pressure on the existing hosting solution as CSScriptNpp.x64.dll is a fixed native dll that is never recompiled and potentially reused by many other plugins. I will need to find a work around.

  2. I have another question though. Do you know what is the plugin manager update frequency? But I could not find any relevant info on bruderstein/npp-plugins-x64.

    I had to implement plugin's own updater as with N++ x86 the updating plugins every 3-4 month was not sustainable. It wasn't possible neither responsively fix defects nor support plugin users. It is tempting now to remove it and rely completely on N++ PluginManager.

    The question is simple: How much time will it take for plugin to be delivered on the user PC from the moment of creating the PR (with the plugin update info)?

oleg-shilo commented 6 years ago

That's it. The x64/x86 portable release is officially here: https://github.com/oleg-shilo/cs-script.npp/releases/tag/v1.7.8.0

Bukran commented 6 years ago

Hi Oleg.

I didn't use Notepad++ 64-bit (and remained with 32-bit version) just because CSScript plugin wasn't available until not long ago. I downloaded latest Notepad++ 64-bit version (7.5.5) but CSScript plugin 1.7.8 isn't working (see attached image). Any ideas?

Thanks. csscriptplugin

BTW, the same happens with the x86 versions (both Notepad++ and plugin, obviously)

oleg-shilo commented 6 years ago

The message N++ is displaying is extremely misleading. The problem has nothing to do with the compatibility between the host an the plugin.

What it means is that the plugin failed to start. Nothing less, nothing more.

There can be quite a few possible causes of the failure.

It can be caused by the user unpacking the plugin binaries (in case of manual install) with WinRar or WinZip. These utils silently lock the assemblies.

It can also be caused by the absence of the to system dependencies (e.g. correct .NET installed).

The first direct piece of the information that you need to have a look at is the plugin log with the startup error.

Can you check C:\Users\<user>\AppData\Roaming\Notepad++\plugins\logs\CSScriptNpp\last_startup_error.txt?

Bukran commented 6 years ago

Thanks Oleg.

As usual, you did pinpoint in the right direction. Last startup error was a FileNotFoundException of CSScriptIntellisense.dll although the file was present in the directory. So I unzipped the plugin on its own folder and, after that, I copied the files in Notepad++ plugins directory. Now everything works as expected.

The assemblies were probably locked (unzipped with Windows utility FYI).

Thank you.

oleg-shilo commented 6 years ago

Cool.

To be honest I am lost for words because of the ignorance of the person who decided that silently locking the assemblies downloaded from the internet is a good idea.

Don't get me wrong. Locking (sanitizing) binaries that came from the public domain is not necessarily a bad thing. But doing this without telling anyone is a true shocker.

I completely stopped using ZIP format because of that. Thank God for 7zip.