【问题标题】:System.Windows.Media.DrawingVisual.RenderOpen() erroring after a timeSystem.Windows.Media.DrawingVisual.RenderOpen() 一段时间后出错
【发布时间】:2011-06-10 15:03:46
【问题描述】:

用例:我正在使用 WPF 在 Web 上下文中动态覆盖图像上的文本。

解决方案: 我正在使用来自DrawingVisualDrawingContext(包装在using 语句中)来绘制原始位图和覆盖文本。

问题:在几千个请求之后,[DrawingVisual].RenderOpen() 方法开始拒绝执行并抛出以下异常:

The system cannot find the file specified System.ComponentModel.Win32Exception UInt16 RegisterClassEx(WNDCLASSEX_D) at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)
at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
at System.Windows.Media.MediaContextNotificationWindow..ctor(MediaContext ownerMediaContext)
at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher)
at System.Windows.Media.MediaContext.From(Dispatcher dispatcher)
at System.Windows.Media.Visual.VerifyAPIReadWrite()
at System.Windows.Media.DrawingVisual.RenderOpen()
at ...

临时修复:解决此问题的唯一方法是回收服务器上的 IIS 应用程序池,从而将问题修复几个小时。

问题:有人知道这个问题的原因(泄漏、线程、非托管代码等)吗?有没有其他方法可以在图像上获取文本以避免绘图视觉?也许将几何图形写入位图并直接覆盖位图?

【问题讨论】:

  • 我也有类似的问题:stackoverflow.com/questions/5195808/…
  • 你能分享一下你是如何获得 DrawingContext 和 DrawingVisual 的代码 sn-p 吗?为什么不直接回收 DrawingVisual?您是否允许 Dispatcher 抽水?
  • 我知道这是一个老问题,但是进程是否泄漏内存或句柄?似乎挂起转储有助于找到问题的根源?

标签: .net wpf iis rendering system.windows.media


【解决方案1】:

这是一个旧补丁 - 我会假设它包含在 .NET 4.x 中 - 但我不太确定。无论如何 - 你可以试一试。

» Discussion & Bug Report

».NET Patch(x86)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 2017-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多