Jump to content

Hi, I have a problem about installing the latest update of Paint.net (4.3.1)


Kierof
 Share

Go to solution Solved by Rick Brewster,

Recommended Posts

Hello, everybody. My name is Kierof and I think I have a problem about running Paint.net after I installed the latest update.

Look at the picture below. I was about finding the way to making program running again. I found this problem since yesterday when the program notified me about installing the latest version of paint.net. (which is 4.3.1) When I installed it, the program cannot be run and using about 18% of CPU.

Is there any advise to help this? I'm very thank you for whoever can solve this problem!

image.thumb.png.a0cfd27bab0305f695a4553f3c746682.png

Link to comment
Share on other sites

Looks like the same issue reported over here: https://forums.getpaint.net/topic/118696-paintnet-43-is-not-responding-for-me-when-i-open-it/

 

 

We don't have a solution yet, but could you try the same troubleshooting attempts? (e.g. run with /disablePlugins, and with the parameter to disable hardware acceleration?)

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

Well I can't fix it until I know what's going on

 

Can you create a performance trace? https://forums.getpaint.net/topic/113249-how-to-submit-a-performance-trace/

 

 

Basically, start the trace recording, then start Paint.NET, let it hang, then let it sit for 10 seconds or so, then save the trace. You might need to upload it to a cloud sharing thing because the files can get large.

 

If Paint.NET is sitting there chewing up CPU (you said 18%), this will tell me where in the code it's chewing up CPU, and that will be the smoking gun I need.

 

Feel free to ask any questions to help get this trace stuff working, it's not the simplest thing to get going.

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

@Kierof, when the program hangs like this, are you opening a specific image, or just starting the app (which gives you the default/blank image) ?

 

If the former (a specific image), can you share that image? Something's goofy with some metadata handling ...

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

This is what I'm able to see from the performance trace. It seems that the code that handles the DPI / resolution is getting into some kind of infinite loop. The units of measurement for DPI are being retrieved, but they don't exist in the image (which is normal), so the code sets it to the default. Then an event is raised to notify the other parts of the app that the units have changed (which is normal). But then it just starts over again and keeps going in around in circles (not normal).

 

@null54 might you have a clue here? I'll keep looking into this, maybe I haven't had enough caffeine, but I can't yet figure out why this is happening. Thankfully the symbols and stacks are loading in this trace. @Kierof this was very helpful :)

 

image.png

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

I might have an idea. I checked with ILSpy. PaintDotNet.Document.DpuUnit's getter and setter method seems to end up calling each other recursively.

 

Floating point value equality check seems wrong in DpuX/DpuY setter methods which is called by DpuUnit's setter method. DpuUnit also sets DpuX and DpuY values to 1.0 in its setter.

if (DpuUnit == MeasurementUnit.Pixel && value != 1.0)

 

I'd do floating point equality checks with a tolerance value. Also ordering of expressions look important to me. Because second expression is depending on another property's value and this makes the code more prone to bugs.

 

if (Math.Abs(value - 1.0) > 0.1 && DpuUnit == MeasurementUnit.Pixel)

 

Link to comment
Share on other sites

Yes, the recursive call is at the heart of this matter which is causing the infinite loop. Although why app keeps spinning around in circles instead of crashing with a stack overflow is unclear to me.

 

This is ooooooolllllllldddddddddd code (ca. 2005) and has always worked fine, despite being an objectively terrible, awful, ugly, and (dare I say) dumb way of doing it. But, it should work.

 

get_DpuUnit shouldn't need to remember that it just set the value via set_DpuUnit. It should be able to get the value when it calls into Metadata.GetExifPropertyItems(). My current investigation is looking into why Metadata either can't find the EXIF metadata, or isn't storing it correctly, or isn't caching it correctly.

 

If I can catch this in the act then it should be very easy to solve. If there's an image that causes this to happen, then all I need is the image. If this happens even when launching Paint.NET without an image to open (e.g. just click on the app icon in Start, taskbar, desktop, anywhere) then it must be dependent on some other factor. The diagnostic info that @WinnythailandFX posted over at https://forums.getpaint.net/topic/118696-paintnet-43-is-not-responding-for-me-when-i-open-it/ shows en-US (English U.S.) as the culture/locale, so I'm not sure it's that. All of the string handling in Metadata is using the Invariant culture with case-insensitivity, so it shouldn't be dependent on a user or system setting.

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

32 minutes ago, Rick Brewster said:

My current investigation is looking into why Metadata either can't find the EXIF metadata, or isn't storing it correctly, or isn't caching it correctly.

 

Worst case paint.net can not rely on the Metadata 'remembering' (or it just takes some time). Always a mess if issues can not be reproduced locally.

midoras signature.gif

Link to comment
Share on other sites

Okay I figured it out. The key ended up noticing this one line over in @WinnythailandFX's diagnostics info:

 

Build Date    4 สิงหาคม 2563 (August 4, 2021)

 

Using Google Translate to translate "สิงหาคม" reveals that it's Thai (th-TH). If I set CultureInfo.CurrentCulture to th-TH at app startup, then the hang reproduces.

 

The code causing the problem is deep in the bowels of some old crusty code over in SystemLayer's PropertyItem2, which is used for serializing/deserializing GDI+ PropertyItem instances:

 

        private static string GetProperty(string blob, string propertyName)
        {
            string findMe = propertyName + "=\"";
            int startIndex = blob.IndexOf(findMe) + findMe.Length;
            int endIndex = blob.IndexOf("\"", startIndex);
            string propertyValue = blob.Substring(startIndex, endIndex - startIndex);
            return propertyValue;
        }

 

If blob equals e.g. "<exif id=\"296\" len=\"2\" type=\"3\" value=\"AgA=\" />", the startIndex and endIndex values are 10 and 10, respectively. These are definitely not the right values, and we get an empty string, and the calling code can't parse an empty string to an integer. An exception is raised, and the error handling code doesn't really do the right thing either.

 

Adding StringComparison.InvariantCultureIgnoreCase to the IndexOf calls and voila, it works.

  • Thanks 1
  • Upvote 1
  • You're a Smart Cookie! 2

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

@Kierof and @WinnythailandFX, try installing this build to verify that my fix is correct:

In the meantime, I'll start pushing a new 4.3.2 update ASAP.

  • Thanks 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

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...