On Security tab of the file properties, I compared the permissions of Heic files in that folder with JPG files in that same folder. All files had the exact same perms set for: Authenticated Users, Admins, and Users. But the JPG files open fine, while HEIC throw the exception.
I just tried another test: opened a regular TIF file in Paint.NET, then tried "Save As" to my desktop. Save As JPG works. Save As HEIC generates a similar exception:
Application version: paint.net 4.2.11 (β 4.211.7433.39692)
System.AggregateException: One or more errors occurred. ---> PaintDotNet.Data.WicEncodeException: location = FrameCommit ---> System.UnauthorizedAccessException: D:\src\pdn\src\SystemLayer.Native\Imaging\WICBitmapFrameEncode.cpp (273) : hr = m_pBitmapFrameEncode->Commit();
at PaintDotNet.Interop.InteropErrorInfo.ThrowIfError() in D:\src\pdn\src\Base\Interop\InteropErrorInfo.cs:line 98
at PaintDotNet.SystemLayer.Native.x64.NativeUtilities.ThrowOnErrorImpl(Int32 hr, SByte* szHr, IUnknown* pFxErrorInfo)
at PaintDotNet.SystemLayer.Native.x64.Imaging.WICBitmapFrameEncode.Commit()
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 283
--- End of inner exception stack trace ---
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 287
at PaintDotNet.Data.WicEncoder.Encode(IBitmapSource source, Vector2Double dpi, IReadOnlyList`1 exifPropertyItems, XmpPacket xmpPacket, Stream output, ContainerFormat containerFormat, Nullable`1 preferredVendor, IEnumerable`1 encoderOptions, IMetadataTranscoder metadataTranscoder, WriteSourceMode writeSourceMode, ProgressEventHandler progressCallback, Object progressCallbackSender, Double progressPercentStart) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 267
at PaintDotNet.Data.WicEncoder.Encode(WicEncodeParameters parameters) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 137
at PaintDotNet.Data.WicEncoder.Encode() in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 57
--- End of inner exception stack trace ---
at PaintDotNet.Data.WicEncoder.AddExceptionAndThrowAll(Exception ex) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 101
at PaintDotNet.Data.WicEncoder.Encode() in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 83
at PaintDotNet.Data.WicFileTypeHelpers.Save(Document document, Surface flattenedSurface, Stream output, ContainerFormat containerFormat, Nullable`1 preferredVendor, IMetadataTranscoder metadataTranscoder, IEnumerable`1 encoderOptions, SavableBitDepths bitDepth, Int32 ditherLevelForIndexed, ProgressEventHandler progressCallback, Object progressCallbackSender) in D:\src\pdn\src\PaintDotNet\Data\WicFileTypeHelpers.cs:line 355
at PaintDotNet.Data.HeifFileType.OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) in D:\src\pdn\src\PaintDotNet\Data\HeifFileType.cs:line 144
at PaintDotNet.FileType.Save(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback, Boolean rememberToken) in D:\src\pdn\src\Data\FileType.cs:line 292
at PaintDotNet.Dialogs.SaveConfigDialog.<>c__DisplayClass49_0.<UpdatePreviewAsync>b__0() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 614
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PaintDotNet.Dialogs.SaveConfigDialog.<UpdatePreviewAsync>d__49.MoveNext() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 633
---> (Inner Exception #0) PaintDotNet.Data.WicEncodeException: location = FrameCommit ---> System.UnauthorizedAccessException: D:\src\pdn\src\SystemLayer.Native\Imaging\WICBitmapFrameEncode.cpp (273) : hr = m_pBitmapFrameEncode->Commit();
at PaintDotNet.Interop.InteropErrorInfo.ThrowIfError() in D:\src\pdn\src\Base\Interop\InteropErrorInfo.cs:line 98
at PaintDotNet.SystemLayer.Native.x64.NativeUtilities.ThrowOnErrorImpl(Int32 hr, SByte* szHr, IUnknown* pFxErrorInfo)
at PaintDotNet.SystemLayer.Native.x64.Imaging.WICBitmapFrameEncode.Commit()
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 283
--- End of inner exception stack trace ---
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 287
at PaintDotNet.Data.WicEncoder.Encode(IBitmapSource source, Vector2Double dpi, IReadOnlyList`1 exifPropertyItems, XmpPacket xmpPacket, Stream output, ContainerFormat containerFormat, Nullable`1 preferredVendor, IEnumerable`1 encoderOptions, IMetadataTranscoder metadataTranscoder, WriteSourceMode writeSourceMode, ProgressEventHandler progressCallback, Object progressCallbackSender, Double progressPercentStart) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 267
at PaintDotNet.Data.WicEncoder.Encode(WicEncodeParameters parameters) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 137
at PaintDotNet.Data.WicEncoder.Encode() in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 57<---
---> (Inner Exception #1) PaintDotNet.Data.WicEncodeException: location = UnhandledEncodeError ---> PaintDotNet.Data.WicEncodeException: location = FrameCommit ---> System.UnauthorizedAccessException: D:\src\pdn\src\SystemLayer.Native\Imaging\WICBitmapFrameEncode.cpp (273) : hr = m_pBitmapFrameEncode->Commit();
at PaintDotNet.Interop.InteropErrorInfo.ThrowIfError() in D:\src\pdn\src\Base\Interop\InteropErrorInfo.cs:line 98
at PaintDotNet.SystemLayer.Native.x64.NativeUtilities.ThrowOnErrorImpl(Int32 hr, SByte* szHr, IUnknown* pFxErrorInfo)
at PaintDotNet.SystemLayer.Native.x64.Imaging.WICBitmapFrameEncode.Commit()
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 283
--- End of inner exception stack trace ---
at PaintDotNet.Data.WicEncoder.Try(WicEncodeLocation location, Action action) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 287
at PaintDotNet.Data.WicEncoder.Encode(IBitmapSource source, Vector2Double dpi, IReadOnlyList`1 exifPropertyItems, XmpPacket xmpPacket, Stream output, ContainerFormat containerFormat, Nullable`1 preferredVendor, IEnumerable`1 encoderOptions, IMetadataTranscoder metadataTranscoder, WriteSourceMode writeSourceMode, ProgressEventHandler progressCallback, Object progressCallbackSender, Double progressPercentStart) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 267
at PaintDotNet.Data.WicEncoder.Encode(WicEncodeParameters parameters) in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 137
at PaintDotNet.Data.WicEncoder.Encode() in D:\src\pdn\src\PaintDotNet\Data\WicEncoder.cs:line 57
--- End of inner exception stack trace ---<---