none
KB4537820 causes System.ComponentModel.Win32Exception in .Net framework System.Drawing.Icon for WinForms apps on Windows 7 SP1 RRS feed

  • Question

  • I need to report what appears to be a serious bug in the KB4537820 windows 7 sp1 automatic update that was released 11th Feb 2020 (https://support.microsoft.com/en-au/help/4537820/windows-7-update-kb4537820).

    It is causing .net based applications to fail to start or crash due during operation due to unexpected Win32 exceptions related to the internal System.Drawing.Icon library. This has already started rolling out automatically to Windows 7 point of sale touchscreens and is causing their .net application based systems to fail completely.

    Uninstalling that specific windows update fixes the issue.

    An example of the failure error if accessing the Icon class is

    System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully
       at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
       at System.Drawing.Icon..ctor(String fileName, Int32 width, Int32 height)

    Another example occuring during startup of a WinForms application

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: The parameter is incorrect
       at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
       at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
       at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
       at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
       at System.Runtime.Serialization.ObjectManager.DoFixups()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex)
       at System.Resources.ResourceReader._LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
       at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
       at System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode)
       at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString)
       at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase)
       at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
       at System.Resources.ResourceManager.GetObject(String name)
       at ClientApp_WinForms.MainForm.InitializeComponent()
       at ClientApp_WinForms.MainForm..ctor()
       at ClientApp_Win.Program.Main(String[] args)"

    I can confirm so far I have seen this across a number of different .net apps, some using .net 4, others using .net 4.6.1




    Thursday, February 13, 2020 7:29 AM

Answers

All replies

  • Hi CraigTankard,

    I have moved the thread to Where's the forum for forum to help you find the corrrect forum to go ask questions.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    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.

    Thursday, February 13, 2020 8:49 AM
  • I posted in the .net framework forum because its an issue affecting .net framework, it is being caused by a windows update, but given what it actually impacts, i thought .net framework would be the correct place as the error is occurring in System.Drawing which is .net framework.

    If not there, then hopefully someone can point me to the correct location.

    • Edited by CraigTankard Thursday, February 13, 2020 8:55 AM
    Thursday, February 13, 2020 8:54 AM
  • I posted in the .net framework forum because its an issue affecting .net framework, it is being caused by a windows update, but given what it actually impacts, i thought .net framework would be the correct place as the error is occurring in System.Drawing which is .net framework.

    If not there, then hopefully someone can point me to the correct location.

    Hello,

    you posted in the developer forum for questions about own written source code using .net framework.
    Since your issue is caused by a Windows update, you should better ask here:

    https://answers.microsoft.com/en-us/windows/forum/windows_7-update

    Regards, Guido


    Thursday, February 13, 2020 10:38 AM
    Moderator
  • For problems with the winform application you can ask for help here.

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?category=windowsforms

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Thursday, February 13, 2020 2:10 PM
    Moderator
  • Another vote for this set of circumstances. Our application fails immediately upon startup.

    Monday, February 17, 2020 12:25 PM
  • We found the issue on our platform - a corrupted form icon.

    If a WinForm has its Icon property assigned in the forms designer, it is instantiated during the InitializeComponent() method called from the form's constructor. The line:

    this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

    is where the error occurs.

    To examine the icon, locate it in the form's nested resources.resx file. From there you can export it to a standalone file and examine it using the Visual Studio image editor. Ours was very garbled.

    Replace (or remove) the icon and recompile.

    We tested our changes on a Windows 7 Enterprise machine spun up with Windows Azure as part of our MS developer subscription.

    We are fixing this as a top priority in case the same breaking change is propagated to the next Windows 10 update.

    Tuesday, February 18, 2020 12:36 PM
  • Hi all,

    I got exactly the same issue. I modify the icons files which were the root cause. And it's working now.

    It's completly crazy. I don't understand how we can accept this issue.

    Many applications have to be recompile just to change corrupted icons.

    For me, it's not acceptable and a fix should be raised to correct this update.

    Thanks to take in account my request.

    Monday, March 9, 2020 4:33 PM