Jump to content

FileTypeOptions.SupportsCancellation


midora

Recommended Posts

Unfortunately the doc comments don't get baked into the DLL, but this is what it says.

 

This should be left at the default, true, unless it's really difficult for you to not support it. Whenever you do an operation on the Stream, or report progress via the ProgressEventHandler, an OperationCanceledException may be thrown (but only if this property is true). Often you don't need to do much when that happens, just let the exception propagate. Native resources should be handled carefully though, with try/finally blocks, or by wrapping them in managed objects with finalizers (e.g. SafeHandle).

 

This is important so that the user can quickly change the options in the Save Configuration dialog. It is not (currently) used when loading or saving, only when doing "preview saving" in Save Configuration.

 

/// <summary>
/// If true, then the Stream and/or ProgressEventHandler may throw an OperationCanceledException so as to cancel
/// the save/load operation. This is usually encountered when the user is changing options in the Save Configuration
/// dialog.
/// </summary>
/// <remarks>
/// The default value for this property is true.
/// </remarks>
public bool SupportsCancellation
{
    get
    {
        return this.supportsCancellation;
    }

    set
    {
        VerifyNotFrozen();
        this.supportsCancellation = value;
    }
}

 

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

BTW the default is actually false for older plugins that use the old deprecated/obsolete FileType constructors. You can't compile a new plugin this way, however, it's purely for compatibility.

 

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

  • 4 weeks later...

Sometimes my ImAPNG filetype crashes in 4.3.3 if I'm changing the options to fast.

If the crash happens then there is no OnSave OperationCancelException in my trace output. paint.net just dies.

Setting SupportsCancellation to false avoids this issue. But that's not really a solution.

The plugin reports progress regularly for each frame of the animation.

 

midoras signature.gif

Link to comment
Share on other sites

If PDN just "dies" and disappears then you're probably causing an access violation in your code somewhere.

 

Run Paint.NET with the /setenv:COMPlus_legacyCorruptedStateExceptionsPolicy=1 parameter, or open a command prompt and execute set COMPlus_legacyCorruptedStateExceptionsPolicy=1 before launching paintdotnet.exe (from within the command prompt). You should then get an actual crash log that shows you (probably) where the access violation is occurring.

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

If you get a crash log then you'll see the crash log dialog. The crash logs are always in the location accessible through Settings -> Diagnostics -> Open Crash Log Folder.

 

Another way to investigate this would be to attach Visual Studio's debugger to paintdotnet.exe, then reproduce the crash. Debugger should break right where it happens. 

 

image.png

Make sure to enable both "Managed (.NET Core, .NET 5+)" and "Native" debugging types with the "Select" button in the Attach to Process dialog

 

image.png

  • 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

17 hours ago, Rick Brewster said:

You should then get an actual crash log that shows you (probably) where the access violation is occurring.

 

Let me rephrase this ... You should then get an actual crash dialog, which will then come with a crash log. If you don't see a crash dialog then it didn't work.

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

Attached the debugger and now I'm getting a crash log window reporting an OperationCanceledExeption.

 

Spoiler

This text file was created because paint.net crashed. Please e-mail this to crashlog4@getpaint.net so we can diagnose and fix the problem.

Application version: paint.net 4.3.3 (Stable 4.303.7994.40115)
Time of crash: 01/12/2021 07:09:10
Application uptime: 00:02:45.1154572
Application state: Running
Working set: 528.376 KiB
Handles and threads: 1323 handles, 57 threads, 254 gdi, 286 user
Install type: Portable
Application directory: C:\dev\paint.net.4.3.3.portable.x64
Current directory: C:\dev\paint.net.4.3.3.portable.x64
Install directory: C:\Program Files\paint.net
OS Version: Windows 10 Home 10.0.19043.0 x64
.NET version: .NET 6.0.0-rtm.21522.10 x64
Processor: "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz" @ ~2304MHz (4C/8T, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2)
Physical memory: 16100 MB
Video card: Intel(R) UHD Graphics (v:8086, d:9B41, r:2), Microsoft Basic Render Driver (v:1414, d:8C, r:0)
Hardware acceleration: True (default: True)
Pointers: none
UI animations: True
UI DPI: 120 dpi (1,25x scale)
UI theme: VisualStyleCategory=Aero, EffectiveTheme=Aero, DWM=yes, AeroColorScheme=Dark, ThemeFileName=Aero.msstyles
Updates: n/a
Locale: pdnr.c: en-US, hklm: n/a, hkcu: en-US, cc: en-CH, cuic: en-US
Flags:

Exception details:
System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at PaintDotNet.IO.CancelableStream.Write(Byte[] buffer, Int32 offset, Int32 count) in D:\src\pdn\src\PaintDotNet\IO\CancelableStream.cs:line 78

Managed assemblies:
    System.Private.CoreLib, .\System.Private.CoreLib.dll, Version=6.0.0.0, PublicKeyToken=7cec85d7bea7798e
    paintdotnet, .\paintdotnet.dll, Version=4.303.7994.40115
    System.Runtime, .\System.Runtime.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.Base, .\PaintDotNet.Base.dll, Version=4.303.7994.40115
    System.Windows.Forms, .\System.Windows.Forms.dll, Version=6.0.0.0, PublicKeyToken=b77a5c561934e089
    System.Diagnostics.Process, .\System.Diagnostics.Process.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    TerraFX.Interop.Windows, .\TerraFX.Interop.Windows.dll, Version=10.0.20348.0, PublicKeyToken=35b01b53313a6f7e
    PaintDotNet.SystemLayer, .\PaintDotNet.SystemLayer.dll, Version=4.303.7994.40115
    System.Runtime.InteropServices.RuntimeInformation, .\System.Runtime.InteropServices.RuntimeInformation.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.InteropServices, .\System.Runtime.InteropServices.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.SystemLayer.Native.x64, .\PaintDotNet.SystemLayer.Native.x64.dll, Version=4.303.7994.40115
    System.Threading, .\System.Threading.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Extensions, .\System.Runtime.Extensions.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.CompilerServices.VisualC, .\System.Runtime.CompilerServices.VisualC.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Collections.NonGeneric, .\System.Collections.NonGeneric.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Intrinsics, .\System.Runtime.Intrinsics.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    PaintDotNet.Core, .\PaintDotNet.Core.dll, Version=4.303.7994.40115
    System.Private.Uri, .\System.Private.Uri.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.ComponentModel.Primitives, .\System.ComponentModel.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Windows.Forms.Primitives, .\System.Windows.Forms.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b77a5c561934e089
    WindowsBase, .\WindowsBase.dll, Version=6.0.0.0, PublicKeyToken=31bf3856ad364e35
    PresentationFramework, .\PresentationFramework.dll, Version=6.0.0.0, PublicKeyToken=31bf3856ad364e35
    System.Drawing.Primitives, .\System.Drawing.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Xaml, .\System.Xaml.dll, Version=6.0.0.0, PublicKeyToken=b77a5c561934e089
    System.ComponentModel, .\System.ComponentModel.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Collections, .\System.Collections.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Diagnostics.TraceSource, .\System.Diagnostics.TraceSource.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Threading.Thread, .\System.Threading.Thread.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Text.Encoding.CodePages, .\System.Text.Encoding.CodePages.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    Microsoft.Win32.Primitives, .\Microsoft.Win32.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.Resources, .\PaintDotNet.Resources.dll, Version=4.303.7994.40115
    Newtonsoft.Json, .\Newtonsoft.Json.dll, Version=13.0.0.0, PublicKeyToken=30ad4fe6b2a6aeed
    System.Linq.Expressions, .\System.Linq.Expressions.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.ComponentModel.TypeConverter, .\System.ComponentModel.TypeConverter.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.ObjectModel, .\System.ObjectModel.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Configuration.ConfigurationManager, .\System.Configuration.ConfigurationManager.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Collections.Specialized, .\System.Collections.Specialized.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Numerics, .\System.Runtime.Numerics.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Xml.ReaderWriter, .\System.Xml.ReaderWriter.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.Data, .\PaintDotNet.Data.dll, Version=4.303.7994.40115
    System.Private.Xml, .\System.Private.Xml.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Net.WebClient, .\System.Net.WebClient.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.ComponentModel.EventBasedAsync, .\System.ComponentModel.EventBasedAsync.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Memory, .\System.Memory.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Text.Encoding.Extensions, .\System.Text.Encoding.Extensions.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.Framework, .\PaintDotNet.Framework.dll, Version=4.303.7994.40115
    System.Drawing.Common, .\System.Drawing.Common.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    Microsoft.Win32.SystemEvents, .\Microsoft.Win32.SystemEvents.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Collections.Immutable, .\System.Collections.Immutable.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Linq, .\System.Linq.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    Microsoft.Win32.Registry, .\Microsoft.Win32.Registry.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Threading.ThreadPool, .\System.Threading.ThreadPool.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Collections.Concurrent, .\System.Collections.Concurrent.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PresentationCore, .\PresentationCore.dll, Version=6.0.0.0, PublicKeyToken=31bf3856ad364e35
    DirectWriteForwarder, .\DirectWriteForwarder.dll, Version=6.0.0.0, PublicKeyToken=31bf3856ad364e35
    System.Diagnostics.Debug, .\System.Diagnostics.Debug.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    UIAutomationTypes, .\UIAutomationTypes.dll, Version=6.0.0.0, PublicKeyToken=31bf3856ad364e35
    System.Diagnostics.FileVersionInfo, .\System.Diagnostics.FileVersionInfo.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PaintDotNet.Effects, .\PaintDotNet.Effects.dll, Version=4.303.7994.40115
    Accessibility, .\Accessibility.dll, Version=4.0.0.0, PublicKeyToken=31bf3856ad364e35
    System.Threading.Tasks.Parallel, .\System.Threading.Tasks.Parallel.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Reflection.MetadataLoadContext, .\System.Reflection.MetadataLoadContext.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Reflection.Metadata, .\System.Reflection.Metadata.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.IO.Packaging, .\System.IO.Packaging.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.IO.MemoryMappedFiles, .\System.IO.MemoryMappedFiles.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Numerics.Vectors, .\System.Numerics.Vectors.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Diagnostics.Tracing, .\System.Diagnostics.Tracing.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Loader, .\System.Runtime.Loader.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    ImAPNG.FileType, .\FileTypes\ImAPNG.FileType\ImAPNG.FileType.dll, Version=1.4.0.0
    ImAGIF.FileType, .\FileTypes\ImAGIF.FileType\ImAGIF.FileType.dll, Version=1.6.0.0
    AvifFileType, .\Bundled\AvifFileType\AvifFileType.dll, Version=1.1.17.0
    WebPFileType, .\Bundled\WebPFileType\WebPFileType.dll, Version=1.3.7.0
    DdsFileTypePlus, .\Bundled\DDSFileTypePlus\DdsFileTypePlus.dll, Version=1.10.10.0
    System.IO.FileSystem, .\System.IO.FileSystem.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Serialization.Formatters, .\System.Runtime.Serialization.Formatters.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    mscorlib, .\mscorlib.dll, Version=4.0.0.0, PublicKeyToken=b77a5c561934e089
    System.Security.Claims, .\System.Security.Claims.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.CodeDom, .\System.CodeDom.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.Text.RegularExpressions, .\System.Text.RegularExpressions.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.CompilerServices.Unsafe, .\System.Runtime.CompilerServices.Unsafe.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Diagnostics.StackTrace, .\System.Diagnostics.StackTrace.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Private.Xml.Linq, .\System.Private.Xml.Linq.dll, Version=6.0.0.0, PublicKeyToken=cc7b13ffcd2ddd51
    System.IO.Compression, .\System.IO.Compression.dll, Version=6.0.0.0, PublicKeyToken=b77a5c561934e089
    System.Runtime.Serialization.Primitives, .\System.Runtime.Serialization.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    PresentationFramework-SystemXmlLinq, .\PresentationFramework-SystemXmlLinq.dll, Version=6.0.0.0, PublicKeyToken=b77a5c561934e089
    System.Xml.XDocument, .\System.Xml.XDocument.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Xml.Linq, .\System.Xml.Linq.dll, Version=4.0.0.0, PublicKeyToken=b77a5c561934e089
    System.Console, .\System.Console.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    Microsoft.VisualStudio.DesignTools.WpfTap, c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\xamldiagnostics\Core\x64\Microsoft.VisualStudio.DesignTools.WpfTap.dll, Version=16.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.IO.Pipes, .\System.IO.Pipes.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Threading.Tasks, .\System.Threading.Tasks.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Serialization.Json, .\System.Runtime.Serialization.Json.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Private.DataContractSerialization, .\System.Private.DataContractSerialization.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Runtime.Serialization.Xml, .\System.Runtime.Serialization.Xml.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Resources.ResourceManager, .\System.Resources.ResourceManager.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Reflection.Emit.ILGeneration, .\System.Reflection.Emit.ILGeneration.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Reflection.Emit.Lightweight, .\System.Reflection.Emit.Lightweight.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a
    System.Reflection.Primitives, .\System.Reflection.Primitives.dll, Version=6.0.0.0, PublicKeyToken=b03f5f7f11d50a3a

Native modules:
    .\paintdotnet.exe, version=4.303.7994.40115
    C:\WINDOWS\SYSTEM32\ntdll.dll, version=10.0.19041.1023 (WinBuild.160101.0800)
    C:\WINDOWS\System32\KERNEL32.DLL, version=10.0.19041.1348 (WinBuild.160101.0800)
    C:\WINDOWS\System32\KERNELBASE.dll, version=10.0.19041.1348 (WinBuild.160101.0800)
    C:\WINDOWS\System32\USER32.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\win32u.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\System32\GDI32.dll, version=10.0.19041.1202 (WinBuild.160101.0800)
    C:\WINDOWS\System32\gdi32full.dll, version=10.0.19041.1110 (WinBuild.160101.0800)
    C:\WINDOWS\System32\msvcp_win.dll, version=10.0.19041.789 (WinBuild.160101.0800)
    C:\WINDOWS\System32\ucrtbase.dll, version=10.0.19041.789 (WinBuild.160101.0800)
    C:\WINDOWS\System32\SHELL32.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\ADVAPI32.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\msvcrt.dll, version=7.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\sechost.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\RPCRT4.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\IMM32.DLL, version=10.0.19041.546 (WinBuild.160101.0800)
    .\hostfxr.dll, version=6,0,21,52210 @Commit: 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6
    .\hostpolicy.dll, version=6,0,21,52210 @Commit: 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6
    .\coreclr.dll, version=6,0,21,52210 @Commit: 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6
    C:\WINDOWS\System32\ole32.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\System32\combase.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\System32\OLEAUT32.dll, version=10.0.19041.985 (WinBuild.160101.0800)
    C:\WINDOWS\System32\bcryptPrimitives.dll, version=10.0.19041.1348 (WinBuild.160101.0800)
    .\System.Private.CoreLib.dll, version=6.0.21.52210
    .\clrjit.dll, version=6,0,21,52210 @Commit: 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6
    C:\WINDOWS\SYSTEM32\kernel.appcore.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    .\paintdotnet.dll, version=4.303.7994.40115
    .\System.Runtime.dll, version=6.0.21.52210
    C:\WINDOWS\system32\uxtheme.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    .\PaintDotNet.Base.dll, version=4.303.7994.40115
    .\System.Windows.Forms.dll, version=6.0.21.52301
    .\System.Diagnostics.Process.dll, version=6.0.21.52210
    .\TerraFX.Interop.Windows.dll, version=10.0.20348.0
    .\PaintDotNet.SystemLayer.dll, version=4.303.7994.40115
    .\System.Runtime.InteropServices.RuntimeInformation.dll, version=6.0.21.52210
    .\System.Runtime.InteropServices.dll, version=6.0.21.52210
    .\vcruntime140.dll, version=14.30.30704.0 built by: vcwrkspc
    .\vcruntime140_1.dll, version=14.30.30704.0 built by: vcwrkspc
    .\msvcp140.dll, version=14.30.30704.0 built by: vcwrkspc
    .\msvcp140_1.dll, version=14.30.30704.0 built by: vcwrkspc
    .\msvcp140_2.dll, version=14.30.30704.0 built by: vcwrkspc
    .\msvcp140_codecvt_ids.dll, version=14.30.30704.0 built by: vcwrkspc
    .\vcomp140.dll, version=14.30.30704.0 built by: vcwrkspc
    .\ijwhost.dll, version=6,0,21,52210 @Commit: 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6
    .\PaintDotNet.SystemLayer.Native.x64.dll, version=4.303.7994.40115
    C:\WINDOWS\SYSTEM32\PROPSYS.dll, version=7.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.1348_none_91a2627ccc89e3fb\gdiplus.dll, version=10.0.19041.1348 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\WindowsCodecs.dll, version=10.0.19041.1151 (WinBuild.160101.0800)
    C:\WINDOWS\System32\bcrypt.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    .\System.Threading.dll, version=6.0.21.52210
    .\System.Runtime.Extensions.dll, version=6.0.21.52210
    .\System.Runtime.CompilerServices.VisualC.dll, version=6.0.21.52210
    .\System.Collections.NonGeneric.dll, version=6.0.21.52210
    .\System.Runtime.Intrinsics.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\windows.storage.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\Wldp.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\SHCORE.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\shlwapi.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    .\PaintDotNet.Core.dll, version=4.303.7994.40115
    .\System.Private.Uri.dll, version=6.0.21.52210
    .\System.ComponentModel.Primitives.dll, version=6.0.21.52210
    .\System.Windows.Forms.Primitives.dll, version=6.0.21.52301
    .\WindowsBase.dll, version=6.0.21.52301
    .\PresentationFramework.dll, version=6.0.21.52301
    .\System.Drawing.Primitives.dll, version=6.0.21.52210
    .\System.Xaml.dll, version=6.0.21.52301
    .\System.ComponentModel.dll, version=6.0.21.52210
    .\System.Collections.dll, version=6.0.21.52210
    .\System.Diagnostics.TraceSource.dll, version=6.0.21.52210
    .\System.Threading.Thread.dll, version=6.0.21.52210
    .\System.Text.Encoding.CodePages.dll, version=6.0.21.52210
    .\Microsoft.Win32.Primitives.dll, version=6.0.21.52210
    .\PaintDotNet.Resources.dll, version=4.303.7994.40115
    .\Newtonsoft.Json.dll, version=13.0.1.25517
    .\System.Linq.Expressions.dll, version=6.0.21.52210
    .\System.ComponentModel.TypeConverter.dll, version=6.0.21.52210
    .\System.ObjectModel.dll, version=6.0.21.52210
    .\System.Configuration.ConfigurationManager.dll, version=6.0.21.52210
    .\PresentationNative_cor3.dll, version=6,0,21,48001 @Commit: bf6f24c075ff5315d0ec0e5359138ee796b0491c
    .\System.Collections.Specialized.dll, version=6.0.21.52210
    .\System.Runtime.Numerics.dll, version=6.0.21.52210
    .\System.Xml.ReaderWriter.dll, version=6.0.21.52210
    .\PaintDotNet.Data.dll, version=4.303.7994.40115
    .\System.Private.Xml.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\icu.dll, version=64, 2, 0, 0 (WinBuild.160101.0800)
    .\System.Net.WebClient.dll, version=6.0.21.52210
    .\System.ComponentModel.EventBasedAsync.dll, version=6.0.21.52210
    .\System.Memory.dll, version=6.0.21.52210
    .\System.Text.Encoding.Extensions.dll, version=6.0.21.52210
    .\PaintDotNet.Framework.dll, version=4.303.7994.40115
    .\System.Drawing.Common.dll, version=6.0.21.52210
    .\Microsoft.Win32.SystemEvents.dll, version=6.0.21.52210
    .\System.Collections.Immutable.dll, version=6.0.21.52210
    .\System.Linq.dll, version=6.0.21.52210
    .\Microsoft.Win32.Registry.dll, version=6.0.21.52210
    .\System.Threading.ThreadPool.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\dxgi.dll, version=10.0.19041.1266 (WinBuild.160101.0800)
    C:\WINDOWS\System32\MSCTF.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    .\System.Collections.Concurrent.dll, version=6.0.21.52210
    .\PresentationCore.dll, version=6.0.21.52301
    .\DirectWriteForwarder.dll, version=6,0,21,52301 @Commit: 3f75a67c752a116de292affae29a22bbb5b71b18
    .\System.Diagnostics.Debug.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\dwrite.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    .\UIAutomationTypes.dll, version=6.0.21.52301
    .\System.Diagnostics.FileVersionInfo.dll, version=6.0.21.52210
    .\PaintDotNet.Effects.dll, version=4.303.7994.40115
    .\Accessibility.dll, version=6.0.21.52301
    C:\WINDOWS\System32\clbcatq.dll, version=2001.12.10941.16384 (WinBuild.160101.0800)
    C:\WINDOWS\System32\UIAnimation.dll, version=10.0.19041.746 (WinBuild.160101.0800)
    .\System.Threading.Tasks.Parallel.dll, version=6.0.21.52210
    .\System.Reflection.MetadataLoadContext.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\version.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    .\System.Reflection.Metadata.dll, version=6.0.21.52210
    .\System.IO.Packaging.dll, version=6.0.21.52210
    .\System.IO.MemoryMappedFiles.dll, version=6.0.21.52210
    C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e\comctl32.dll, version=6.10 (WinBuild.160101.0800)
    .\System.Numerics.Vectors.dll, version=6.0.21.52210
    .\System.Diagnostics.Tracing.dll, version=6.0.21.52210
    .\ucrtbase.dll, version=10.0.19041.685 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\TextShaping.dll, version=
    .\System.Runtime.Loader.dll, version=6.0.21.52210
    .\FileTypes\ImAPNG.FileType\ImAPNG.FileType.dll, version=1.4.0.0
    .\FileTypes\ImAGIF.FileType\ImAGIF.FileType.dll, version=1.6.0.0
    C:\WINDOWS\SYSTEM32\mfplat.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\cfgmgr32.dll, version=10.0.19041.1151 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\RTWorkQ.DLL, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\CompPkgSup.DLL, version=10.0.19041.746 (WinBuild.160101.0800)
    C:\Windows\System32\Windows.StateRepositoryPS.dll, version=10.0.19041.844 (WinBuild.160101.0800)
    .\Bundled\AvifFileType\AvifFileType.dll, version=1.1.17.0
    .\Bundled\WebPFileType\WebPFileType.dll, version=1.3.7.0
    .\Bundled\DDSFileTypePlus\DdsFileTypePlus.dll, version=1.10.10.0
    .\System.IO.FileSystem.dll, version=6.0.21.52210
    C:\Windows\System32\WinTypes.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\d2d1.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\wtsapi32.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\WINSTA.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\d3d11.dll, version=10.0.19041.1202 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\D3D10Warp.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\dxcore.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\UIAutomationCore.dll, version=7.2.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\sxs.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    .\System.Runtime.Serialization.Formatters.dll, version=6.0.21.52210
    .\mscorlib.dll, version=6.0.21.52210
    .\System.Security.Claims.dll, version=6.0.21.52210
    .\System.CodeDom.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\dwmapi.DLL, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\dataexchange.dll, version=10.0.19041.1151 (WinBuild.160101.0800)
    C:\WINDOWS\system32\dcomp.dll, version=10.0.19041.1266 (WinBuild.160101.0800)
    C:\WINDOWS\system32\twinapi.appcore.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\textinputframework.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\System32\CoreUIComponents.dll, version=10.0.19041.546
    C:\WINDOWS\System32\CoreMessaging.dll, version=10.0.19041.746
    C:\WINDOWS\System32\WS2_32.dll, version=10.0.19041.1081 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\ntmarta.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\powrprof.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\UMPDC.dll, version=
    .\System.Text.RegularExpressions.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\winmm.DLL, version=10.0.19041.1 (WinBuild.160101.0800)
    .\System.Runtime.CompilerServices.Unsafe.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\oleacc.dll, version=7.2.19041.746 (WinBuild.160101.0800)
    C:\WINDOWS\system32\explorerframe.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    .\System.Diagnostics.StackTrace.dll, version=6.0.21.52210
    .\Microsoft.DiaSymReader.Native.amd64.dll, version=14.28.29715.1 built by: vcwrkspc
    C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_ea63d1eddd5853b5\igd10iumd64.dll, version=26.20.100.6911
    C:\WINDOWS\SYSTEM32\ncrypt.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\NTASN1.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_ea63d1eddd5853b5\igdgmm64.dll, version=26.20.100.6911
    C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_ea63d1eddd5853b5\igc64.dll, version=26.20.100.6911
    .\System.Private.Xml.Linq.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\policymanager.dll, version=10.0.19041.1320 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\msvcp110_win.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    .\System.IO.Compression.dll, version=6.0.21.52210
    C:\WINDOWS\SYSTEM32\profapi.dll, version=10.0.19041.844 (WinBuild.160101.0800)
    .\System.Runtime.Serialization.Primitives.dll, version=6.0.21.52210
    .\PresentationFramework-SystemXmlLinq.dll, version=6.0.21.52301
    .\System.Xml.XDocument.dll, version=6.0.21.52210
    .\System.Xml.Linq.dll, version=6.0.21.52210
    .\System.Console.dll, version=6.0.21.52210
    c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\xamldiagnostics\x64\Microsoft.VisualStudio.DesignTools.WpfTapBootstrap.dll, version=16.0.31603.221
    C:\WINDOWS\SYSTEM32\mscoree.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll, version=4.8.4180.0 built by: NET48REL1LAST_B
    c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\xamldiagnostics\Core\x64\Microsoft.VisualStudio.DesignTools.WpfTap.dll, version=16.11.31603.221
    .\System.IO.Pipes.dll, version=6.0.21.52210
    .\System.Threading.Tasks.dll, version=6.0.21.52210
    .\System.Runtime.Serialization.Json.dll, version=6.0.21.52210
    .\System.Private.DataContractSerialization.dll, version=6.0.21.52210
    .\System.Runtime.Serialization.Xml.dll, version=6.0.21.52210
    .\System.Resources.ResourceManager.dll, version=6.0.21.52210
    .\System.Reflection.Emit.ILGeneration.dll, version=6.0.21.52210
    .\System.Reflection.Emit.Lightweight.dll, version=6.0.21.52210
    .\System.Reflection.Primitives.dll, version=6.0.21.52210
    C:\WINDOWS\System32\comdlg32.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\XmlLite.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\Windows\System32\Windows.FileExplorer.Common.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\LINKINFO.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\DUI70.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\DUser.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\thumbcache.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\Windows.UI.FileExplorer.dll, version=10.0.19041.1202 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\edputil.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\atlthunk.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\StructuredQuery.dll, version=7.0.19041.867 (WinBuild.160101.0800)
    C:\Windows\System32\iertutil.dll, version=11.00.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\Windows.Storage.Search.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\SspiCli.dll, version=10.0.19041.1266 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\samcli.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\SAMLIB.dll, version=10.0.19041.1348 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\netutils.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\MPR.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\drprov.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\ntlanman.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\davclnt.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\DAVHLPR.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\wkscli.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\cscapi.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\System32\coml2.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\Windows\System32\twinapi.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\msieftp.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\urlmon.dll, version=11.00.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\SHDOCVW.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\system32\srvcli.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\apphelp.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\system32\WININET.dll, version=11.00.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\dlnashext.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\PlayToDevice.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\DevDispItemProvider.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Users\osieka\AppData\Local\Microsoft\OneDrive\21.220.1024.0005\FileSyncShell64.dll, version=21.220.1024.0005
    C:\WINDOWS\System32\CRYPT32.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\Secur32.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\USERENV.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\WINDOWS\system32\NetworkExplorer.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\Windows\System32\EhStorShell.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\SETUPAPI.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\ntshrui.dll, version=10.0.19041.1165 (WinBuild.160101.0800)
    C:\WINDOWS\System32\MMDevApi.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\DEVOBJ.dll, version=10.0.19041.1151 (WinBuild.160101.0800)
    C:\Windows\System32\PortableDeviceApi.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\System32\WINTRUST.dll, version=10.0.19041.1266 (WinBuild.160101.0800)
    C:\WINDOWS\System32\MSASN1.dll, version=10.0.19041.546 (WinBuild.160101.0800)
    C:\Windows\System32\PortableDeviceTypes.dll, version=10.0.19041.746 (WinBuild.160101.0800)
    C:\Windows\System32\EhStorAPI.dll, version=10.0.19041.1 (WinBuild.160101.0800)
    C:\WINDOWS\SYSTEM32\PhotoMetadataHandler.dll, version=10.0.19041.746 (WinBuild.160101.0800)
------------------------------------------------------------------------------

 

 

The VS output window shows

 

Spoiler

{X=0,Y=0,Width=500,Height=122}, dispose=0Save frame 46 of 486, region={X=0,Y=7,Width=500,Height=143}, dispose=0Save frame 47 of 486, region={X=0,Y=0,Width=500,Height=121}, dispose=0Exception thrown at 0x00007FFFEFDD4F69 (KernelBase.dll) in paintdotnet.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.
The thread 0x1b80 has exited with code 0 (0x0).
'paintdotnet.exe' (Win32): Loaded 'C:\dev\paint.net.4.3.3.portable.x64\vcruntime140_cor3.dll'.
The thread 0x8ec has exited with code -2146233029 (0x8013153b).
The thread 0x1824 has exited with code -2146233029 (0x8013153b).
The thread 0x42c8 has exited with code -2146233029 (0x8013153b).
The thread 0x1398 has exited with code -2146233029 (0x8013153b).
The thread 0xb2c has exited with code -2146233029 (0x8013153b).
The thread 0x4760 has exited with code -2146233029 (0x8013153b).
The thread 0x1224 has exited with code -2146233029 (0x8013153b).
The thread 0x3d18 has exited with code -2146233029 (0x8013153b).
The thread 0x47d0 has exited with code -2146233029 (0x8013153b).
The thread 0x3d00 has exited with code -2146233029 (0x8013153b).
The thread 0x4b74 has exited with code -2146233029 (0x8013153b).
The thread 0x1e58 has exited with code -2146233029 (0x8013153b).
The thread 0x22b8 has exited with code -2146233029 (0x8013153b).
The thread 0x10e8 has exited with code -2146233029 (0x8013153b).
The thread 0x40f8 has exited with code -2146233029 (0x8013153b).
The thread 0x3ad8 has exited with code -2146233029 (0x8013153b).
The thread 0x3244 has exited with code -2146233029 (0x8013153b).
The thread 0x258c has exited with code -2146233029 (0x8013153b).
The thread 0x44b4 has exited with code -2146233029 (0x8013153b).
The thread 0x46c0 has exited with code -2146233029 (0x8013153b).
The thread 0x2cc8 has exited with code -2146233029 (0x8013153b).
The thread 0x460 has exited with code -2146233029 (0x8013153b).
The thread 0x3d50 has exited with code -2146233029 (0x8013153b).
The thread 0x4414 has exited with code -2146233029 (0x8013153b).
The thread 0x47b0 has exited with code -2146233029 (0x8013153b).
The thread 0x1e04 has exited with code -2146233029 (0x8013153b).
The thread 0x4278 has exited with code -2146233029 (0x8013153b).
The thread 0x1620 has exited with code -2146233029 (0x8013153b).
The thread 0x3c9c has exited with code -2146233029 (0x8013153b).
The thread 0x4418 has exited with code -2146233029 (0x8013153b).
The thread 0x1338 has exited with code -2146233029 (0x8013153b).
The thread 0x4034 has exited with code -2146233029 (0x8013153b).
The thread 0x17ac has exited with code -2146233029 (0x8013153b).
The thread 0x320c has exited with code -2146233029 (0x8013153b).
The thread 0x4584 has exited with code -2146233029 (0x8013153b).
The thread 0x3388 has exited with code -2146233029 (0x8013153b).
The thread 0x960 has exited with code -2146233029 (0x8013153b).
The thread 0x2b5c has exited with code -2146233029 (0x8013153b).
The thread 0x158c has exited with code -2146233029 (0x8013153b).
The thread 0x2558 has exited with code -2146233029 (0x8013153b).
The thread 0x4874 has exited with code -2146233029 (0x8013153b).
The thread 0x4354 has exited with code -2146233029 (0x8013153b).
The thread 0x32c has exited with code -2146233029 (0x8013153b).
The thread 0x3c6c has exited with code -2146233029 (0x8013153b).
The thread 0x3548 has exited with code -2146233029 (0x8013153b).
The thread 0x1e8c has exited with code -2146233029 (0x8013153b).
The thread 0x40ec has exited with code -2146233029 (0x8013153b).
The thread 0x1b70 has exited with code -2146233029 (0x8013153b).
The thread 0x4b10 has exited with code -2146233029 (0x8013153b).
The thread 0x248 has exited with code -2146233029 (0x8013153b).
The thread 0x493c has exited with code -2146233029 (0x8013153b).
The thread 0x28e0 has exited with code -2146233029 (0x8013153b).
The thread 0x4994 has exited with code -2146233029 (0x8013153b).
The thread 0x2b58 has exited with code -2146233029 (0x8013153b).
The thread 0x4304 has exited with code -2146233029 (0x8013153b).
The thread 0x3e20 has exited with code -2146233029 (0x8013153b).
The thread 0x3504 has exited with code -2146233029 (0x8013153b).
The program '[6612] paintdotnet.exe' has exited with code -2146233029 (0x8013153b).

 

 

Means the save operation has been aborted while writing image frame 47 of 486.

 

Or is this misleading now if paint.net reports the OperationCanceledException?

 

midoras signature.gif

Link to comment
Share on other sites

2 hours ago, midora said:

{X=0,Y=0,Width=500,Height=121}, dispose=0Exception thrown at 0x00007FFFEFDD4F69 (KernelBase.dll) in paintdotnet.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.

 

It looks like the OperationCanceledException may be causing a second exception to be thrown from within the native code that kills the process.

Although, I may be wrong about that.

 

I ran into a similar issue with older versions of my WebP FileType.

The OperationCanceledException was triggering an access violation in the native code.

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

Maybe I should tell that the plugin is using Microsoft WinAny DynamicNativeLibrary to load lthe latest libpng 1.6.37 from an embedded resource (just to avoid the external dll issues). The other unsafe native stuff is the typical Bitmap handling. I may check what happens switching to external dlls.

midoras signature.gif

Link to comment
Share on other sites

2 hours ago, midora said:

Maybe I should tell that the plugin is using Microsoft WinAny DynamicNativeLibrary to load lthe latest libpng 1.6.37 from an embedded resource (just to avoid the external dll issues).

 

That could definitely cause an issue if the managed code throws an exception.

I have worked with libpng in some of my projects, e.g. the G'MIC 8bf plugin.

 

The error handling is based on setjmp, so I would recommend wrapping the libpng code in a C/C++ DLL that your PDN plugin calls.

This is probably easier that trying to get the libpng error handling working from C#.

The gmic-8bf PNG writer may be of use as an example:  https://github.com/0xC0000054/gmic-8bf/blob/main/src/common/PngWriter.cpp

 

The most important thing is that any exception that is thrown in a callback on the managed side must be caught and re-thrown after returning from the native code.

This allows the native code to cleanly shutdown before Paint.NET sees any exceptions on the managed side.

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

To disable longjmp I'm using

 

                png_set_error_fn(png_ptr_ptr, IntPtr.Zero,
                    Marshal.GetFunctionPointerForDelegate((Delegate) new png_error_ptr(HandleError)),
                    Marshal.GetFunctionPointerForDelegate((Delegate) new png_error_ptr(HandleWarning)));

 

        public void HandleError(IntPtr png_ptr, string msg)
        {
            System.Diagnostics.Trace.WriteLine("ERROR: " + msg);
            throw new Exception(msg);
        }

 

and this seems to work. During development I have seen the ERROR/Warning message in the log, paint.net catched the exception and showed it in an error dialog.

 

I'm catching and rethrowing exceptions in the managed code (and dump them to the trace log). But it may be that if the plugin is just executing unmanaged code it does not catch the exception and fails to clean up. But why should the application die in the case of a c# eception?

 

 

 

 

midoras signature.gif

Link to comment
Share on other sites

Yeah it sounds like an exception is happening in managed code (the OperationCanceledException) and it's propagating to native code, and it won't know what to do with it -- in fact, it may just ignore it and keep marching forward, which could easily result in an AV because your managed code is in an inconsistent state.

 

When you have native code calling back into your managed code through a function pointer, it's important to catch any exceptions and translate them into something that the native code understands. For Win32 code this usually means HRESULTs.

 

So, don't throw exceptions from managed code over into native code. It won't know what to do, and it may just drop them. Exceptions don't always propagate across the barrier, in other words.

 

If you have a link to your code I can probably spot what's going on and give you some suggestions.

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:

If you have a link to your code I can probably spot what's going on and give you some suggestions.

Thanks for the offer. In the moment the code is just in a local repository to track changes. I may place it on github sometime but because I never did it, its just an isuue on my to do list 😉 So I may come back.

In the moment I'm just setting SupportsCancellation to false. That's no long term solution but in the moment I'm more interested to get it to run. Because png offers more color variants than gif this part of the code is a little bit more complex. I may add an SIGSEGV handler but that's not really a solution.

 

midoras signature.gif

Link to comment
Share on other sites

4 hours ago, midora said:

To disable longjmp I'm using

 

I see 2 issues with those snippets.

 

1. The delegates that you are passing to png_set_error_fn could be collected by the GC, the delegates should be a field in the containing class.

2. Your HandleError method need to call png_destroy_write_struct(png_ptr_ptr, info_ptr_ptr) to cleanup the libpng data before throwing the exception.

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

OperationCanceledException thrown by Paint.NET on CancelableStream. Plugins have no idea what the stream type is nor whether if the underlying stream can throw that exception. It's not listed in possible exceptions: https://docs.microsoft.com/en-us/dotnet/api/system.io.stream.write?view=net-6.0#Exceptions

 

System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at PaintDotNet.IO.CancelableStream.Write(Byte[] buffer, Int32 offset, Int32 count) in D:\src\pdn\src\PaintDotNet\IO\CancelableStream.cs:line 78

 

This problem generally means the plugin is not thread-safe. You should try using locks in more places and see if that crash repeats. If possible, try wrapping your whole OnSave method in a lock block. Your plugin needs to be thread-safe for preview generation. Also you should catch (in the plugin's code) OperationCanceledException and initiate the cleanup and reset state or you'll have memory leaks and crashes.

 

I'd like to have an official way to disable Preview generation and have completely different API for preview generation (like OnGeneratePreview() method) so I don't have to use hacks like Stopwatch.

 

Link to comment
Share on other sites

44 minutes ago, null54 said:

1. The delegates that you are passing to png_set_error_fn could be collected by the GC, the delegates should be a field in the containing class.

 

You are absolutely right about this. Thanks.

 

45 minutes ago, null54 said:

Your HandleError method need to call png_destroy_write_struct(png_ptr_ptr, info_ptr_ptr) to cleanup the libpng data before throwing the exception.

 

I guess there was a complete misunderstanding on my side about the call stack. I guess I had in mind that the throw will be catched by the plugin which does the cleanup.

 

 

midoras signature.gif

Link to comment
Share on other sites

44 minutes ago, otuncelli said:

Your plugin needs to be thread-safe for preview generation.

 

But load and save are completly independent. And both should be thread safe for sure. I will not implement locks around the whole code just because paint.net throws an OperationCancelledException.

 

I started this topic because I had only an idea what this new setting means and I (and maybe others) just learned that paint.net throws this exception and that you should clean up. 

 

 

midoras signature.gif

Link to comment
Share on other sites

6 hours ago, midora said:

I will not implement locks around the whole code just because paint.net throws an OperationCancelledException.

 

For debugging only, to see if it still crashes. It's generally easy to wrap portions of code in a lock block and test.

 

Load and Save are different and your managed code might be completely seems thread-safe/independent but if you've a native library reference, it's a different story. For example, every pinvoke call in one of my plugin (alternative pdf) in a lock block, otherwise it crashes because the native library I use is not thread-safe itself.

 

Anyway, it seems like your issue was different and not related to thread-safety like mine.

Edited by otuncelli
Link to comment
Share on other sites

@otuncelliIt really depends on the library. The first thing in libpng is to request a kind of handle which is later used for other library calls and because there is one handle for read and another for write there is no issue. 

 

The main issue is that the access of the managed stream in the native code may throw an exception. I can catch it but this doesn't help because re-throw can not unwind the stack to the caller of the native code.

 

managed save plug in => native write method => managed write call back => catched exception => re-throw kills Paint.NET

 

This was really something I didn't had in mind and @null54may be right that the only solution is to wrap code in setjmp/longjmp. But there are so many native methods that I do not like this solution.

 

managed save plug in => native write method, setjmp => managed write call back => catched exception, longjmp back to native method, return error to save plugin, throw exception.

 

 

midoras signature.gif

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.

×
×
  • Create New...