问题描述
我有一个服务,它使用以下内容呈现WPF控件并将它们保存为图像:
I have a service which renders WPF controls and saves them as an image using the following:
Private Shared Function ConvertToBitmap(uiElement As UIElement, resolution As Double) As RenderTargetBitmap
Dim scale = resolution / 96.0
uiElement.Measure(New Size([Double].PositiveInfinity, [Double].PositiveInfinity))
Dim sz = uiElement.DesiredSize
Dim rect = New Rect(sz)
uiElement.Arrange(rect)
Dim bmp = New RenderTargetBitmap(CInt(scale * (rect.Width)), CInt(scale * (rect.Height)), resolution, resolution, PixelFormats.[Default])
bmp.Render(uiElement)
Return bmp
End Function
自KB 4041083 / KB 4040973(.NET Framework 3.5.1的安全和质量汇总,4.5.2,4.6,
4.6.1,4.6 .2和4.7 for Windows 7 SP1和Windows Server 2008 R2 SP1:
2017年9月12日)安装了renderi ng不再有效,我最终得到一张空白图片。
这在服务中运行时似乎只是一个问题,而不是在通过窗口应用程序运行时。
卸载此更新可解决此问题。关于解决方案的任何想法,直到(如果)修复程序为此发布?
由于
Since KB 4041083 / KB 4040973 (Security and Quality Rollup for the .NET Framework 3.5.1, 4.5.2, 4.6,
4.6.1, 4.6.2, and 4.7 for Windows 7 SP1 and Windows Server 2008 R2 SP1:
September 12, 2017) was installed rendering no longer works and I end up with a blank image.
This only seems to be a problem when run in a service and not when run via a windowed application.
Uninstalling the update fixes the issue. Any ideas on a work-around until (if) a fix is released for this?
Since
推荐答案
这篇关于KB 4041083 / KB 4040973已破坏服务中的WPF渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!