-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to add ScintillaNET control from Toolbox for v5.3.2.4 and newer in WinForms (.NET Framework) #68
Comments
Be reassured, the problem does not come from the version of the NET framework nor even from the version of Scintilla.NET (5.3.2.4 or .5 or .7) but simply from Scintilla.NET in taking into account the management of differences between .NET and .NET Framework in integrating Nuget packages.
And that's where it gets stuck.
and a "packages" directory is added which will contain the description of the packages with a sub-directory for each package. |
...but all of the above is for documentary purposes.
to replace the code in the file scintilla.cs:
If you are interested, I could DIY you a modified Scintilla.NET.5.3.2.7 version and how to replace it in your current project. |
The revert option would be fine otherwise but then it would dismiss the changes in #50? Those were made in my understanding to allow to control to work in a "more secure environment". E.g. extracting the files might be a suspicious process to some virus checker. So if the #50 changes are not reverted I would welcome a PR or some help to make the package compatible with the .NET Framework UI Designer. |
The proposed solution I just sent seems to be fine since it does not use embedded satellite dlls and changing the LocateNativeDllDirectory function would only affect the .NetFramework 4.5 version in the package (unless other corrections are needed in other parts of the Scintilla.Net code) since the problem does not arise with the .Net versions of the dll. |
Regarding the tests with SharpDevelop, the question is solved: in the latest version, the packages manager uses Nuget's V2 protocol and I haven't found a solution to make it work. As for MonoDevelop, apart from its full and cumbersome installation, I haven't found a packages manager feature to import a nuget package into the project. As for the tests with VS 2022 and the .NET Framework version, the modifications that I proposed (slightly modified) allow you to add a Scintilla.NET control in a form of a Windows Forms application (.NET Framework). Attached is the code for the |
Hi, But doesn't support other NET Framework versions (should the compiler directive I also tested with NET 7 WinForms application and this seems to work fine. Thank you very much @lgaudouen! |
For my tests, I used VS 2022 17.7.2 and the latest .NET versions: I haven't installed .NET 8.0 yet but will soon (.NET 8 will be officially released in November 2023, currently only a Preview version) To get the modified package, I used the code obtained from https://github.com/VPKSoft/Scintilla.NET/archive/refs/tags/v.5.3.2.7.zip (page https://github.com/VPKSoft/Scintilla.NET/releases/tag/v.5.3.2.7).
If it works like that, you would still have to be particularly vicious to create an application with a framework that is no longer supported and whose design does not allow you to add controls other than native Microsoft ones! With VS 2022, we can see that the problem of Scintilla.NET does not come from the NET45 symbol but I see that you have done tests for .NET 5.0 and .NET 3.1 using Visual Studio Code. Microsoft VSC plugins may be a problem with unsupported platforms. ps: I have the latest versions (x86 and x64) of scintilla and lexilla (Scintilla: 5.3.6, Lexilla: 5.2.6) at your disposal if you wish, which you could integrate into a new version of the package. |
Hi, |
Could I have the slight modifications that you intend to make to my proposal contained in "modifications for .NETFramework 4.5.txt" included in the modified 5.3.2.7 package transmitted that you were therefore able to test? |
Not all Scintilla versions have been released with Scintilla.NET, also not nearly all of the Scintilla control functionality is implemented. E.g. the new version certainly don't get new features from the Scintilla's changes. I'm kind of hoping those will be implemented by the community. I really don't have the time to implement everything by my self - OSS is a community effort. |
BAD NEWS! The solution I have advanced is not one: based on the CurrentDirectory, it does not work in any case or rather it works only in certain cases and under certain conditions. |
Too bad - well lets hope there is a simple solution to be found! I'll keep the PR open, but won't merge it yet. |
GOOD NEWS. Given your patch, of which I do not understand the motivation or the content, and despite this and as you will be able to read later, I have continued to improve what I had proposed to you.
Moreover, you gave the Scintilla.NET package the name ("5.3.6") of the version of scintilla.dll, which led you to modify the method of calculating its name in the dll whose name is version includes 4 fragments ("5.3.6.0"). Since you seem to fear the distinction between .NET and .NETFramework using the NET45 standard symbol used by version 5.3.2.7, I propose a new version of the static Scintilla() and private static string LocateNativeDllDirectory() functions without symbol conditioning, a clearer and more readable code and more tested. As you can see, I desynchronized the package name from the dll names of I join you in one zip file:
Do not worry about the version number of the package that I transmit to you: in accordance with the rules (see https://learn.microsoft.com/en-us/nuget/concepts/package-versioning), the corrected version of the problem with the .NETFramework should be 5.2.8 after the present 5.2.7 (just a patch). If the modifications made seem to resolve the .NET Framework and .NET issues, design mode and runtime, I still have a few questions to deal with: These questions and others (notably those concerning margins and others collections) could lead to the realization of a real Scintilla.NET control designer. It wouldn't be simple (I've made several complex ones but only with .NETFramework) and we'd get out of a "simple" scintilla.dll wrapper, but we could have a nice product for developers who wouldn't have to constantly dive into the scintilla documentation ( a bit like Scintilla.Lexers is starting to do to Scintilla.NET). As for taking into account the functions of scintilla by Scintilla.NET, I was preparing a private note on my reflections on this subject. You tell us that you really don't have the time to implement everything by yourself. |
I applied your changes to the PR #72 with version number of 5.2.8.
I'll leave the PR open for a few days before merging and publishing... |
By testing Scintilla.Lexers.NET, I discovered that the behavior of VS 2022 (17.7.3) is different depending on whether the package is in a stable version (for example "5.3.2.7") or not (for example "6.0.1-alpha.8"). |
I am still experiencing an problem When dragging Scintilla from the toolbox i get 'System.InvalidOperationException: Unable to locate the Scintilla.NET satellite assemblies : directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\packages\Scintilla.NET.5.3.2.8\build\x64' not found before realising there was still an issue i had published to the clickonce app and got the following which looks pretty similar |
I actually have the same problem as you with the package installed from nuget.org. |
Here you go, a new release, worked at least on my test with WinForms designer. I probably messed up something with the versioning on the previous release. |
It seemed to me that it had to work... |
@VPKSoft brilliant thank you, i can confirm 5.3.2.9 is working fine now. my project had become corrupted and there were references in there to 5.3.2.4 that wouldn't update. I ended up uninstalling and then reinstalling. I think that fixed it, might have had to do a bit of minor editing in the .csproj file |
@lgaudouen sorry, forgot to say thanks to you for the work that you put into getting this resolved. |
@lgaudouen i have realised that 5.3.2.9 still isn't working, when a solution is published via ClickOnce |
I have just received the email corresponding to your last post published on issue 68 (14 days ago!...) about the problem of installing an application with ClickOnce and you ask me for an opinion. |
- basePath is initially correct, but after calling "Combine", it is changing the path to end with \bin\build\x64 as an example, which could be something related to changes I made to correct the errors in the build processes, but for now, removing the combine to see if that resolves the issue
Describe the bug
When you try to add the ScintillaNet control to a Form in a WinForms app (.NET Framework 4.5+) you get an exception instead of the control being added.
Error Message
Failed to create component 'Scintilla'. The error message follows:
'System.ComponentModel.Win32Exception (0x80004005): Could not load the Scintilla module at the path 'C:\Users<UserName>\AppData\Local\Microsoft\VisualStudio\17.0_877463f4\ProjectAssemblies\pa0jc1fh.tmw01....\build\x64\Scintilla.dll'. ---> System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found
at ScintillaNET.Scintilla.get_CreateParams()
at System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)
at ScintillaNET.Scintilla..ctor()'
To Reproduce
Expected behavior
The control is added to the form without any exception. This is the case with version 5.3.2.3 and older
Environment:
The text was updated successfully, but these errors were encountered: