如何使用DISABLEUSERCALLBACKEXCEPTION修复Win7应用程序兼容性填充程序

Sco*_*lie 6 c# registry windows-7 winforms

我有一个非常大的C#.NET4 WinForms应用程序,已经生产超过18个月.我们终于在Windows 7上测试了它(这个大型公司尚未迁移).应用程序启动正常并运行,直到我们启动一个非常大的进程(从DB中多次提取并绑定了许多表单和控件).

我们第一次在Win7上启动这个过程,崩溃了,Win7创建了一个应用程序兼容性垫片*.vshost.exe.当我查看注册表

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Run Code Online (Sandbox Code Playgroud)

它显示vshost.exe了值为DISABLEUSERCALLBACKEXCEPTION.

我做了一个搜索,并提出了很少.

有谁知道这会导致什么类型的代码?我想修复代码以防止垫片.

Ana*_*tts 12

彻底阅读这篇博文,我已经解释了整个事情:

http://blog.paulbetts.org/index.php/2010/07/20/the-case-of-the-disappearing-onload-exception-user-mode-callback-exceptions-in-x64/

精简版

超过用户内核用户边界的异常在64位Windows上丢失.

从Windows 7开始,当Native 64位应用程序(即64位操作系统上不是32位)以这种方式崩溃时,将通知程序兼容性助手.如果应用程序没有Windows 7 Manifest,它们会显示一个对话框,告诉您PCA已应用了应用程序兼容性填充程序.

下次运行应用程序时,Windows将模拟Server 2003行为并使异常消失.

为了保留这些异常(因为您希望它们发生),添加"我是为Windows 7设计的"清单条目:

<assembly>
    <!-- We were designed and tested on Windows 7 -->
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--The ID below indicates application support for Windows Vista -->
            <!--It's important to keep this too, since Vista has no idea about
                        Win7's supportedOS GUID -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/
        </application>
    </compatibility>
</assembly>
Run Code Online (Sandbox Code Playgroud)