加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows 10 Creators更新打破了WinForms应用程序/ BSOD

发布时间:2020-12-14 05:34:11 所属栏目:Windows 来源:网络整理
导读:在复杂的WinForms应用程序中有多个层时,Windows 10 Creators崩溃.可以使用下面的代码轻松复制.当悬停或点击 = 40层之上的UI时,系统会因BSOD而崩溃.它应该碰到一个例外. 有没有人知道调整以避免完全崩溃? 码: using System;using System.Collections.Generi
在复杂的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.”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读