SharpVectors: Multiple render exceptions ver 1.7.1

I have a WPF application for production with more svg files. After update package from 1.6.0 to 1.7.1 some users have multiple errors for my app.

I can not get minimal crashed example, because i can not repeat this problem. I have only logs from my app. Problems has only windows 10 users after 5-10 minutes on running. While exceptions throwning all another apps( incl. mouse cursor) freezing

Some Exceptions System.Runtime.InteropServices.COMException MILERR_WIN32ERROR (Исключение из HRESULT: 0x88980003)

 в System.Windows.Media.Imaging.RenderTargetBitmap.FinalizeCreation()
   в System.Windows.Media.Imaging.RenderTargetBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat)
   в MS.Internal.AppModel.IconHelper.GenerateBitmapSource(ImageSource img, Size renderSize)
   в MS.Internal.AppModel.IconHelper.CreateIconHandleFromImageSource(ImageSource image, Size size)
   в MS.Internal.AppModel.IconHelper.GetIconHandlesFromImageSource(ImageSource image, IconHandle& largeIconHandle, IconHandle& smallIconHandle)
   в System.Windows.Window.UpdateIcon()
   в System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
   в System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   в System.Windows.Window.CreateSourceWindowDuringShow()
   в System.Windows.Window.SafeCreateWindowDuringShow()
   в System.Windows.Window.ShowHelper(Object booleanBox)
   в System.Windows.Window.Show()
   в System.Windows.Window.ShowDialog()
   в TecProgV2.WpfCore.MVVMTools.WinWrapper.<>c__DisplayClass4_0.<.ctor>b__6()
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException UCEERR_RENDERTHREADFAILURE (Исключение из HRESULT: 0x88980406)

 в System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   в System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   в System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   в System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   в System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.ComponentModel.Win32Exception the operation completed successfully

в Standard.NativeMethods.CreateRoundRectRgn(Int32 nLeftRect, Int32 nTopRect, Int32 nRightRect, Int32 nBottomRect, Int32 nWidthEllipse, Int32 nHeightEllipse)
   в Microsoft.Windows.Shell.WindowChromeWorker._CreateRoundRectRgn(Rect region, Double radius)
   в Microsoft.Windows.Shell.WindowChromeWorker._SetRoundingRegion(Nullable`1 wp)
   в Microsoft.Windows.Shell.WindowChromeWorker._UpdateFrameState(Boolean force)
   в Microsoft.Windows.Shell.WindowChromeWorker._ApplyNewCustomChrome()
   в Microsoft.Windows.Shell.WindowChromeWorker.<_SetWindow>b__1(Object sender, EventArgs e)
   в System.Windows.Window.OnSourceInitialized(EventArgs e)
   в TecProgV2.WpfCore.Wpf4Window.OnSourceInitialized(EventArgs e)
   в System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   в System.Windows.Window.CreateSourceWindowDuringShow()
   в System.Windows.Window.SafeCreateWindowDuringShow()
   в System.Windows.Window.ShowHelper(Object booleanBox)
   в System.Windows.Window.Show()
   в System.Windows.Window.ShowDialog()
   в TecProgV2.WpfCore.MVVMTools.WinWrapper.<>c__DisplayClass4_0.<.ctor>b__6()
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.OutOfMemoryException

 в System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   в System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   в System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   в System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   в System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

https://docs.microsoft.com/ru-ru/troubleshoot/dotnet/framework/wpf-render-thread-failures

Windows 10 Net Framework 4.0 SharpVectors 1.7.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@paulushub No. Commit ea0bd9eedfec003814fdc16f9d2b33efb0bd2e21 fix my problem. Please create new verison with fix on NuGet.

@panagiotis-bitharis The line Server.Services.WebPages.Private.SvgIconConverter seems to indicate a web page application. By Microsoft: We recommend that you do not use WPF types in a Windows service.

Rendering issues after the September 12, 2017

@paulushub i think, DpiUtilites.GetSystemEffectiveDpi has DC leaks, because you invoke NativeMethods.GetDC and not invoke NativeMethods.ReleaseDC. Please see this method:

        public static void GetSystemEffectiveDpi(out uint dpiX, out uint dpiY)
        {
            using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
            {

                IntPtr handle = g.GetHdc();
                int x = NativeMethods.GetDeviceCaps(handle, (int) NativeMethods.DeviceCap.LOGPIXELSX);
                int y = NativeMethods.GetDeviceCaps(handle, (int) NativeMethods.DeviceCap.LOGPIXELSY);

                // If anything goes wrong, return a reasonable DPI

                dpiX = x > 0 ? (uint) x : _defaultPixelsPerInch;
                dpiY = y > 0 ? (uint) y : _defaultPixelsPerInch;
                g.ReleaseHdc(handle);
            }

        }

Sorry, i don`t understand, why you recalc effective DPI regular. Mabye you can recalulate effective DPI only if screen configuration changed?

@paulushub yes. I update only SharpVectors library. After downgrade library version my users have not problem.

Article on link

These are symptoms of a failure in the render thread. This is a challenging problem to diagnose because the exceptions and call stacks received are generic. Render thread failures will generate one of the calls stacks shown above (or a minor variation thereof) regardless of the root cause. This makes diagnosing the problem, or even recognizing when two crashes or hangs stem from the same root cause, especially difficult.

I can not regular reproduct or reproduct on my PC. Mabye has another library users with this problem?

I can check Intermediate commits, but this not fast, because my users don`t like test apps))))