Skip to content

Known issue: WPF will throw COM Exception when create RenderTargetBitmap too fast #3067

Open
@lindexi

Description

@lindexi
  • .NET Core Version: 3.1.300
  • Windows version: 10.0.18362
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description:

When we use RenderTargetBitmap to take the control screenshots, if our do it too frequent and too fast, then we will find that the framework throws an exception.

Actual behavior:

 System.Runtime.InteropServices.COMException: MILERR_WIN32ERROR

System.Runtime.InteropServices.COMException (0x88980003): MILERR_WIN32ERROR (Exception from HRESULT:0x88980003)
   in System.Windows.Media.Imaging.RenderTargetBitmap.FinalizeCreation()
   in System.Windows.Media.Imaging.RenderTargetBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat)

Expected behavior:

No exception

Minimal repro:

https://github.com/dotnet-campus/wpf-issues/tree/master/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement RequestedProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions