AndrewDavid Posted August 25, 2021 Share Posted August 25, 2021 (edited) @Simon Brown I have been able to decompile and import into VB 2019 one of your failing plugins. CustomFrame.dll. No errors show in any of the files and all references have been linked. I have 2 problems. When I debug, it generates an error message that I can't fix or understand. It sounds like a known issue with no solution. The dll does compile, but will not load into the beta version of Paint.Net 4.300.7906.2652 I was able to rebuild one dll with success (just to learn the process), however I am stuck on this one. Any help would be appreciated. Think of it as a learning curve for me. I would think this procedure could be applied to all the failed plugins that the Authors have abandoned. "ZIP Removed" Seems we have more programmers than artists lately. Any help would be appreciated. Edited August 25, 2021 by AndrewDavid Removed ZIP Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 25, 2021 Share Posted August 25, 2021 You're trying to compile it with v3.36 paint.net assemblies? If you want guaranteed compatibility with v4.3, you should change the TargetFramework from net48 to net5.0-windows, and use the v4.3 assemblies. 1 Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 25, 2021 Author Share Posted August 25, 2021 36 minutes ago, toe_head2001 said: You're trying to compile it with v3.36 paint.net assemblies I had to link the DLL to them to get it to decompile. 37 minutes ago, toe_head2001 said: TargetFramework from net48 to net5.0-windows My VB2019 will only see 4.8 even though I have Net5.0 installed. 40 minutes ago, toe_head2001 said: and use the v4.3 assemblies And that's when the project fills with errors. And that's why I'm stuck Thanks for looking @toe_head2001 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 25, 2021 Share Posted August 25, 2021 15 minutes ago, AndrewDavid said: My VS2019 will only see 4.8 even though I have Net5.0 installed. Right click on the project, and click on 'Edit Project File'. You can then edit the XML directly. Change the value to net5.0-windows . Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 25, 2021 Author Share Posted August 25, 2021 (edited) <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> is what it says OK I changed it to "net5.0-windows" and it didn't like it very much. Now I get this Now to find that json file... Edited August 25, 2021 by AndrewDavid Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 25, 2021 Share Posted August 25, 2021 The Visual Studio Installer should handle it all for you. Make sure this box is checked: Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 25, 2021 Author Share Posted August 25, 2021 Oh Yes. Everything in that list is installed. I did manage to change all the references to 4.3. It generated some simple errors intelligence was able to correct. However there are now too many errors for me to debug. I appreciate the fact the plugin was built on earlier versions of the assemblies and they have been depreciated. That's where a professional is needed to modify the syntax to current language formats. Back to the C# tutorials. 1 hour ago, AndrewDavid said: OK I changed it to "net5.0-windows" and it didn't like it very much. My first line reads Microsoft.NET.Sdk.WindowsDesktop. If I change it to net5.0-windows the project file won't load and I get all kinds of errors. I was changing it in the wrong place. <TargetFramework>net5.0</TargetFramework> is where I changed it. I am getting practice though and I will get better over time (I Hope). Perhaps I picked a plugin that was too old. Thanks for the help. Get some sleep Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted August 25, 2021 Share Posted August 25, 2021 Could you put it up on GitHub? That might make this easier We can jump in and submit pull requests. I can make a private repo for you to use if you prefer Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 25, 2021 Author Share Posted August 25, 2021 @Rick Brewster I took a whole new approach to building the plugin this time and it worked a lot better. Sort of built it from square one. It is posted to GitHub now. My Username is AndrewDavid007 / CustomFrame. Some of the errors I was able to fix, but the ones remaining are beyond my knowledge. I also think you might be interested in seeing the items that are referenced in 4.3 Libraries that are not in 5.0. Should be quick easy fixes for you. Anything else I can do, let me know. 1 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 26, 2021 Share Posted August 26, 2021 I've submitted a Pull Request that fixes compilation. You can see the changes I made. https://github.com/AndrewDavid007/CustomFrame/pull/2 1 2 Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 26, 2021 Author Share Posted August 26, 2021 OK now I'm lost. I did my part on GitHub, Cloned it to a new GitHub folder on my machine and I see everything is locked (Safety is paramount). I synced in my VBE and still see everything is locked. Is his my doing or yours @toe_head2001? On GitHub I see Release and Publish. Do I click on those? What are the next steps? I tried to debug but the dll file is too small (9kb) to be correct. At the end of debug it asked me to link it to a executable and make it the startup app. When I try to edit project file I don't get that screen. (Locked out I assume). So what am I missing? Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 26, 2021 Share Posted August 26, 2021 25 minutes ago, AndrewDavid said: I see everything is locked (Safety is paramount). I synced in my VBE and still see everything is locked. Locked? I not sure what you're talking about. Please post a screenshot. Also, what's VBE? Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 26, 2021 Author Share Posted August 26, 2021 (edited) The little blue icons have appeared. They look like locks. I just figured it out. Source Control was set to GIT. Changed it to none and the locks disappear. VBE = Visual Basic Environment (Visual Studio 2019 Preview) Edited August 26, 2021 by AndrewDavid Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 26, 2021 Share Posted August 26, 2021 Nothing is locked. The blue icon indicates that the file is checked into source control (git). i.e. no pending edits that need to be committed. For debugging, you can follow these steps. The screenshots are outdated, but the information is still correct. https://forums.getpaint.net/topic/4209-how-to-debug-your-plugin/ 20 minutes ago, AndrewDavid said: VBE = Visual Basic Environment (Visual Studio 2019 Preview) Okay... but you're not using Visual Basic; you're using C#. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 26, 2021 Author Share Posted August 26, 2021 Well the debugging is going well. First of all this is the error message from paint Spoiler System.Resources.MissingManifestResourceException HResult=0x80131532 Message=Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name. I also see a problem related to icons. The project is looking for the .png files I think. In what folder should they be placed? Is there a naming convention I have to follow? If that's the case or do I need to do something else. When I debug it stops at line 18 in EffectPlugin.cs 18 public static Bitmap StaticIcon => Resources.cficon; Baby steps. You did not answer my questions about GitHub. Or do I have to get all the bugs worked out? Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 26, 2021 Share Posted August 26, 2021 9 minutes ago, AndrewDavid said: The project is looking for the .png files I think. In what folder should they be placed? Is there a naming convention I have to follow? You can name things whatever you want. Place your text caret on cficon in line 18, and press F12. That will take you to the definition, and you can modify it accordingly. You can also double click on the Resources file within the Solution Explorer, and you can modify it using a GUI. 9 minutes ago, AndrewDavid said: You did not answer my questions about GitHub Those buttons on Github? Those are just for version tagging within source control. There's no need to do that, unless you really want to. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 26, 2021 Author Share Posted August 26, 2021 Still no help. Perhaps you have some tools installed that I don't. Double clicking on it just takes me to the resource file and highlighting "Resource". Error still exists Spoiler Message=Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name. I'm officially stuck Quote Link to comment Share on other sites More sharing options...
midora Posted August 26, 2021 Share Posted August 26, 2021 I downloaded the protect as zip and could build it (after removing three dead references to System.XXX in CustomFrame/Dependencies/Assemblies). The icons are located in resources.cs which uses the namespace CustomFrame.Properties. This namespace embeds the class Resources which contains the embedded icons. Quote Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 26, 2021 Author Share Posted August 26, 2021 @midora Thanks for the help. Overnight @toe_head2001 made a few changes and I just added another one to GitHub. When you say "build it" do you mean build the project file? The current issue is trying to get the dll to work. Have you been able to successfully debug it? The current error I am getting is; Spoiler Exception thrown: 'System.Resources.MissingManifestResourceException' in System.Private.CoreLib.dll An exception of type 'System.Resources.MissingManifestResourceException' occurred in System.Private.CoreLib.dll but was not handled in user code Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name. That's where I am stuck. When debugging, it gives that error on line 18 of EffectPlugin.cs I didn't think rebuilding an old plugin would be so difficult. But it is a good learning experience. Any help you can provide in debugging this would be greatly appreciated. No reason why you can't join us on GitHub as well. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 27, 2021 Share Posted August 27, 2021 You don't even have a RESX file in the project. What ever tool you used for the decompilation did a terrible job. I suggest you delete the Resources.cs file, and then Add a Resource File (RESX) to the project. Project -> Add New Item... -> Resource File Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 27, 2021 Author Share Posted August 27, 2021 CustomFrame.DLL There was a resource file under selectframe.cs / (I deleted it too but I think I still need it) Followed your suggestion and found the resource file the decompiler created. I must of added it to selectframe.cs in error (I do make mistakes) I learned there is a big difference between copying and pasting and or Add new/existing item to a project. And now the good news It successfully built the dll that now runs in Paint.net It doesn't do what the old plugin did so I'm not out of the woods yet. From what I remember, you could open a premade png file to create the custom frame. Although working, it doesn't give that option. I've pushed the changes to GitHub and await your thoughts on this matter. This is where Selectframe.cs comes in. I think that was the functionality it provided. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted August 27, 2021 Share Posted August 27, 2021 Another way to extract the resources is to run ildasm at the command-line. ildasm customframe.dll /all /out=customframe.il The resources will be put in separate files. PDN comes with ildasm.exe now so you won’t have to go fishing for it. (ildasm as in “IL Disassembler”, IL as in “intermediate language,” the byte code that .NET runs) Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 28, 2021 Author Share Posted August 28, 2021 @Rick Brewster @toe_head2001 JusttifyText.DLL Uploaded another broken plugin to GitHub for determining what is causing the failure of the plugin's menu attempt to save/load files. Definitely need help for this one. I can't even find the source code for that functionality. I have been able to create the DLL correctly, I have updated it to run on net5.0-windows and hope you can resolve this loss of functionality. There are about six more plugins that fail in the same manner, so I hope when we determine the correct code for this one, it can be applied to the others. This is the error Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 28, 2021 Share Posted August 28, 2021 1 hour ago, AndrewDavid said: JusttifyText.DLL Where on the forum can I find this plugin? I can't find it in the plugin index. 1 hour ago, AndrewDavid said: I can't even find the source code for that functionality. What tool are you using for de-compilation? Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
AndrewDavid Posted August 28, 2021 Author Share Posted August 28, 2021 30 minutes ago, toe_head2001 said: Where on the forum can I find this plugin? I can't find it in the plugin index. Buried in Unfinished plugins 30 minutes ago, toe_head2001 said: What tool are you using for de-compilation? ILSpy.exe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.