Jump to content

Plugins that fail in the 4.3 Alpha Builds of Paint.NET


AndrewDavid
 Share

Recommended Posts

btw @midora are you aware that your OptionBasedLibrary is basically broken because it assumes effect loading is single-threaded? You should probably switch to ConcurrentDictionary for your next update of OBL

 

Name: Graph Paper
Type: GraphPaperEffect.GraphPaperEffectPlugin
Version: 2.1.0.0
Author: Copyright © toe_head2001
Copyright: Graph Paper
Website: http://www.getpaint.net/redirect/plugins.html
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at OptionControls.OptionContext.GetContext(String id, Assembly assembly, String dlcName)
   at OptionControls.OptionContext.GetContext(String id, Assembly assembly)
   at OptionBased.Effects.OptionBasedEffect..ctor(Type type, Image image, EffectFlags flags)
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at PaintDotNet.Effects.EffectsCollection.TryGetEffectInfoFromType(Type effectType) in D:\src\pdn\src\PaintDotNet\Effects\EffectsCollection.cs:line 454

 

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

For now it'll work fine because all plugins are now loaded into separate AssemblyLoadContexts, which means each plugin gets its own "copy" of your library. But, in general, just don't make assumptions like that.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

4 hours ago, Rick Brewster said:

For now it'll work fine because all plugins are now loaded into separate AssemblyLoadContexts, which means each plugin gets its own "copy" of your library. But, in general, just don't make assumptions like that.

 

I'm pretty sure this was not an assumption 😉. But nobody respects all possible context changes during development. If all plugins are getting a copy it may be more difficult to write a configuration plugin for OBL. May be not. I don't know in the moment.

midoras signature.gif

Link to comment
Share on other sites

  • 2 weeks later...
2 hours ago, AndrewDavid said:

Just installed this one for the first time 
Move the slider 3 - 5 times and Paint just crashes - no crash file.
https://forums.getpaint.net/topic/116703-mathlatex-plugin/

I was unable to get that one to crash. I suspect it's just a bug in the plugin.

 

If PDN is just "disappearing" without a crash log, it may be an access violation. You can (maybe) get an actual stack trace and crash log by launching the app with the /setenv:COMPlus_legacyCorruptedStateExceptionsPolicy=1 command-line parameter

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

1 hour ago, Rick Brewster said:

I was unable to get that one to crash.

 

It appears to be somewhat random, I just kept moving the slider until it breaks into the debugger.

Buffer.MemoryCopy is throwing an ExecutionEngineException.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

48 minutes ago, null54 said:

 

It appears to be somewhat random, I just kept moving the slider until it breaks into the debugger.

Buffer.MemoryCopy is throwing an ExecutionEngineException.

 

Do you have a callstack? Even just a screenshot from the debugger, although I think you can select the callstack rows and Copy them too

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

13 minutes ago, Rick Brewster said:

Do you have a callstack?

 

PaintDotNet.Base.dll!PaintDotNet.BufferUtil.Copy(void* dst, void* src, ulong byteCount) Line 67	C#
PaintDotNet.Core.dll!PaintDotNet.Rendering.SurfaceUtil.RenderImpl<PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra>, PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra>, PaintDotNet.ColorBgra>(ref PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra> src, ref PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra> dst, PaintDotNet.Rendering.Point2Int32 renderOffset) Line 187	C#
PaintDotNet.Core.dll!PaintDotNet.Rendering.SurfaceUtil.RenderImpl<PaintDotNet.ColorBgra>(PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra> src, PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra> dst, PaintDotNet.Rendering.Point2Int32 renderOffset) Line 153	C#
PaintDotNet.Core.dll!PaintDotNet.Surface.CopySurface(PaintDotNet.Rendering.ISurface<PaintDotNet.ColorBgra> source) Line 985	C#
PaintDotNet.Core.dll!PaintDotNet.Surface.CopySurface(PaintDotNet.Surface source) Line 973	C#
[External Code]	
PaintDotNet.Effects.dll!PaintDotNet.Effects.Effect.SetRenderInfo(PaintDotNet.Effects.EffectConfigToken parameters, PaintDotNet.RenderArgs dstArgs, PaintDotNet.RenderArgs srcArgs) Line 195	C#

 

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Okay, that helps. Looks like there's a potential buffer overflow in RenderImpl if the destination surface is taller than the source. Although it looks like a very old bug, so this should also happen in 4.2.16.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

19 hours ago, Rick Brewster said:

Looks like there's a potential buffer overflow in RenderImpl if the destination surface is taller than the source.

 

That may be it, looking up the call stack I see that the destination surface height is 600 and the source surface height is 302.

 

After looking at the 4.2.16 CopySurface implementation in dotPeek, it appears that you missed a srcHeight == dstHeight statement at line 183 in the RenderImpl class.

  • Like 2

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

20 hours ago, null54 said:

 

That may be it, looking up the call stack I see that the destination surface height is 600 and the source surface height is 302.

 

After looking at the 4.2.16 CopySurface implementation in dotPeek, it appears that you missed a srcHeight == dstHeight statement at line 183 in the RenderImpl class.

 

I ended up doing it this way:

 

            if (srcStride == dstStride &&
                dstStride == (dstWidth * bytesPerPixel) &&
                srcWidth == dstWidth &&
                renderOffset.IsZero)
            {
                int copyHeight = Math.Min(srcHeight, dstHeight); // <-- clip height to shorter of the two
                ulong bytes = (ulong)copyHeight * (ulong)dstWidth * (ulong)bytesPerPixel;
                BufferUtil.Copy(dstScan0, srcScan0, bytes);
            }
            else

 

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

On 8/13/2021 at 5:58 PM, AndrewDavid said:

BoltBait's Charts and Graphs v 0.2  https://forums.getpaint.net/topic/114530-boltbaits-charts-and-graphs-plugin-v02-updated-jun-22-2019/
@BoltBait will be providing an updated version

 

Maybe.

 

Does anyone actually use this thing?

 

Anyway, I started working on this last night. I was able to build a new version, but ran into a problem when it was running under Paint.NET:

 

Exception details:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Windows.Forms.DataVisualization.Charting.ChartImage.DataBind()
   at System.Windows.Forms.DataVisualization.Charting.ChartPicture.Paint(Graphics graph, Boolean paintTopLevelElementOnly)
   at System.Windows.Forms.DataVisualization.Charting.ChartImage.GetImage(Single resolution)
   at System.Windows.Forms.DataVisualization.Charting.Chart.SaveImage(Stream imageStream, ImageFormat format)

 

It looks like part of the .NET 5.0 that Paint.NET runs under is missing? @Rick Brewster?

 

Researching...

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

That DLL isn't part of the Desktop Runtime. It appears to be part of the ASP.NET Runtime (https://dotnet.microsoft.com/download/dotnet/5.0).

 

What happens if you also install this nuget package? (you did install System.Windows.Forms.DataVisualization into your solution/project via nuget, right?) https://www.nuget.org/packages/System.Data.SqlClient

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

20 minutes ago, Rick Brewster said:

you did install System.Windows.Forms.DataVisualization into your solution/project via nuget, right?

 

I did this, which allowed me to compile the DLL.

 

20 minutes ago, Rick Brewster said:

What happens if you also install this nuget package?  https://www.nuget.org/packages/System.Data.SqlClient

 

I haven't done this yet. It was late, I was frustrated, and was about to delete the entire project... but, decided to go to bed instead.

 

I'll try tonight.

  • Like 1

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

9 hours ago, BoltBait said:
10 hours ago, Rick Brewster said:

What happens if you also install this nuget package?  https://www.nuget.org/packages/System.Data.SqlClient

 

I haven't done this yet. It was late, I was frustrated, and was about to delete the entire project... but, decided to go to bed instead.

 

I'll try tonight.

 

Grrrr.... I tried this. It builds fine, however, I can't get VS to put the necessary DLL files in the build directory.  I had to hunt all over the system for them. But, I did get it working.  Now to see if I can use ILRepack to combine all 3 DLLs into 1.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

42 minutes ago, BoltBait said:

Now to see if I can use ILRepack to combine all 3 DLLs into 1.

 

Well, that was a fail.

 

Here's the update: https://forums.getpaint.net/topic/114530-boltbaits-charts-and-graphs-plugin-v02-updated-jun-22-2019/?tab=comments#comment-586630

 

 

It works on my system, but is 3 separate files.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...