Windows 10 Creators Updates 破坏了 WinForms 应用程序/蓝屏死机

标签 windows winforms

当复杂的 WinForms 应用中有多个层时,Windows 10 Creators 会崩溃。这可以很容易地用下面的代码重现。当悬停或单击 >= 40 层顶部的 UI 时,系统会崩溃并出现 BSOD。它应该会遇到异常。

有人知道避免完全崩溃的调整吗?

代码:

    using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PanelLayers
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int maxCount = 45;
            int count = 0;
            this.CreateLayers(this, maxCount, ref count);
        }

        private void CreateLayers(Control BaseControl, int MaxCount, ref int Count)
        {
            if(Count == MaxCount)
            {
                Button btn = new Button();
                btn.Text = "Click me";
                btn.Location = new Point(8, 8);
                btn.Click += btn_Click;
                BaseControl.Controls.Add(btn);
            }
            else
            {
                Count++;
                Panel pnl = new Panel();
                pnl.Dock = DockStyle.Fill;
                try
                {
                    BaseControl.Controls.Add(pnl);
                    this.CreateLayers(pnl, MaxCount, ref Count);
                }
                catch(Exception ex)
                {
                    MessageBox.Show(String.Format("Exception hit at count {0}{1}{2}{1}{3}", Count, Environment.NewLine, ex.Message, ex.StackTrace));
                }
            }
        }

        void btn_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Hello Creators Update!");
            this.Close();
        }
    }
}

最佳答案

它看起来可能与 Windows 8/Windows Server 2012 上发现的另一个问题(相同?)有关。参见 here .

更新

Microsoft 已提供修复:https://support.microsoft.com/en-us/help/4022716/windows-10-update-kb4022716

这是它的描述:

"Addressed issue (Error 0x7F) with Windows Forms (WinForms) that causes the system to crash after upgrading to the Creators Update."

关于Windows 10 Creators Updates 破坏了 WinForms 应用程序/蓝屏死机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43583651/

相关文章:

c++ - clang 编译器卡在 Windows 上

c++ - GetLastError() 返回 0 到失败的窗口句柄

c# - 如何在 C# Windows 窗体中将类对象更改为数组列表

c# - 将 List<Double> 绑定(bind)到 WinForms-Listbox

c# - 如何在表单加载时删除所有 DataGridView 行?

c# - 对象数据绑定(bind) c# winforms 不工作

启动应用程序时C# Windows Service COM异常80080005

windows - 如何将自定义文件系统添加到 Window 的格式数据对话框的列表中?

c# - Visual Studio 在运行程序后向 DataGridView 添加列

c# - Datagridview 复选框 C