locked
KB 4041083 / KB 4040973 has broken WPF Rendering in Services RRS feed

  • Question

  • 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

    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
    • Moved by Bob Ding Friday, September 15, 2017 7:50 AM CLR related
    Thursday, September 14, 2017 1:54 PM

All replies

  • Same problem, except in an ASP.NET app.

    Thursday, September 14, 2017 8:08 PM
  • Hi,

    I moved your thread to CLR forum for better help since your question is more related to .NET Framework.

    Your understanding and cooperation will be grateful.

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 15, 2017 7:49 AM
  • We have the same problem in a c# application.
    Friday, September 15, 2017 9:34 AM
  • Care to supply a link to the moved post? It sure would help us follow along. I just spent time searching and also looking through the CLR forum but this does not show up there.

    • Edited by schroedl Friday, September 15, 2017 12:53 PM
    Friday, September 15, 2017 12:46 PM
  • Hi Bob,

    Could you please point us to the correct post in the CLR forum?

    We are experiencing the same problem now in GE Healthcare. Our Norway and China teams are affected (Approx 150 employees). All CI builds are failing on this issue, affecting several of our products. We are working on uninstalling the update on our CI nodes, but we do need a fix for this problem.

    Thank you,

    Jøger Hansegård

    GE Vingmed Ultrasound


    Jøger

    Friday, September 15, 2017 5:15 PM
  • In case someone needs to uninstall on a larger scale, the following command line does the trick. Restart is not required to make the rendering work again. 

    "C:\windows\Microsoft.NET\Framework64\v4.0.30319\SetupCache\v4.6.01055\setup.exe" /uninstallpatch {801C6191-4F3A-3022-A6A7-D38E232F6B2D} /log log.txt /passive /norestart


    Jøger

    Friday, September 15, 2017 6:12 PM
  • me too,

    same problem, only running services.

    This happens with windows 7 x64, windows 2012r2 but not with windows 10 x64

    Cesare

    Saturday, September 16, 2017 6:33 AM
  • Hi Bob,

    Could you please give us an update on this issue? 

    Thanks,

    Jøger Hansegård

    GE Healthcare


    Jøger

    Monday, September 18, 2017 7:16 AM
  • we also experience the issue, black images are generated,

    see also https://stackoverflow.com/questions/46283894/windows-update-kb4040972-73-causes-black-images-with-wpf-classes

    Monday, September 18, 2017 4:44 PM
  • We are having this same issue. Has anyone found a fix, or is the only solution currently to uninstall the related security updates from production?
    Monday, September 18, 2017 5:34 PM
  • Bob, any clarification you can provide or at least a link to where you moved this to in the CLR forum? We are seeing the issue in several of our products as well when running as a service or when creating a separate process from that service to do the same work. We are creating our own KB articles for our customers to uninstall the update if applied to get around this issue.
    Monday, September 18, 2017 10:52 PM
  • Same issue, any rendering with RenderTargetBitmap() on the server side (asp.net) results in an empty image. In order to render WPF controls on the server we make all WPF related calls in a STA dispatcher thread - maybe a culprit?
    Tuesday, September 19, 2017 12:39 AM
  • Same problem in asp.net,   just uninstall KB4040973, all applications work again.
    Tuesday, September 19, 2017 1:22 AM
  • Same problem here. We started to notice as our Deep zoom generator (DeepZoomTools.dll) started to produce black jpegs.

    Works fine from command line or from a desktop app, does not work as service or started from Task scheduler.

    No error messages or exceptions. Installing .net 4.7 update did not help. Putting a local PresentationCore.dll in the library did not help either.

    (KB4040972 is the update for other operating systems).

    Tuesday, September 19, 2017 7:25 AM
  • Hi, I had the same issue and created a bug report @MSFT, please vote as you are affected too:

    https://connect.microsoft.com/VisualStudio/feedback/details/3141218


    • Edited by AndreasPfanner Tuesday, September 19, 2017 9:18 AM
    • Proposed as answer by Wayne Cornish Tuesday, September 19, 2017 12:54 PM
    Tuesday, September 19, 2017 9:17 AM
  • Microsoft has published an article explaining the current workaround.

    See this: https://support.microsoft.com/en-us/help/4043601/rendering-issues-after-the-september-12-2017-net-security-and-quality

    Wednesday, September 20, 2017 1:02 PM
  • I have similar problem since KB4040973 update on Windows 7 SP1 . Our VB.NET controls have stopped working. Removing update KB4040973 we can again use our VB.NET controls.  But once removed our IT pushes the update again. That is a company IT problem for me.  Waiting for a fix.
    Monday, October 30, 2017 7:14 PM
  • The same phenomenon occurs in Windows 10.

    It occurs in Windows 10 Fall Creators Update (Windows 10, version 1709).
    Wednesday, December 20, 2017 9:15 AM