如何使用 DISABLEUSERCALLBACKEXCEPTION 修复 Win7 应用程序兼容性垫片

发布于 2024-10-31 19:32:18 字数 502 浏览 3 评论 0原文

我有一个非常大的 C# .NET4 WinForms 应用程序,该应用程序已投入生产超过 18 个月。我们终于在 Windows 7 上进行了测试(这个大公司还没有迁移)。该应用程序启动良好并运行,直到我们启动一个非常大的进程(从数据库中多次获取并且绑定了许多表单和控件)。

我们第一次在 Win7 上启动该进程时,出现了崩溃,Win7 围绕我们的 *.vshost.exe 创建了一个应用程序兼容性填充程序。当我查看注册表时,

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

它显示 vshost.exe 的值为 DISABLEUSERCALLBACKEXCEPTION

我进行了搜索并得到了很少的结果。

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

I have a very large C# .NET4 WinForms application that has been in production for over 18 months. We are finally testing it on Windows 7 (this large corp. has not migrated yet). The app starts up fine and runs until we start a very large process (multiple fetches from the DB and many forms and controls are bound).

The very first time we start that process on Win7, something crashes and Win7 creates a app compatibility shim around our *.vshost.exe. When I look in the registry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

it shows the vshost.exe with a value of DISABLEUSERCALLBACKEXCEPTION.

I did a search and came up with very little.

Does anyone know what type of code would cause this? I would like to fix the code to prevent the shim.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可遇━不可求 2024-11-07 19:32:18

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

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

简短版本

跨越用户-内核-用户边界的异常在 64 位 Windows 上丢失。

从 Windows 7 开始,当本机 64 位应用程序(即 64 位操作系统上的非 32 位应用程序)以这种方式崩溃时,程序兼容性助手会收到通知。如果应用程序没有 Windows 7 清单,它们会显示一个对话框,告诉您 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>

Read this blog post thoroughly, I've explained the whole thing:

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

Short version

Exceptions that crossed the user-kernel-user boundary were lost on 64-bit Windows.

Starting with Windows 7, when a Native 64-bit application (i.e. not 32-bit on a 64-bit OS) crashes in this fashion, the Program Compatibility Assistant is notified. If the application doesn’t have a Windows 7 Manifest, they show a dialog telling you that PCA has applied an Application Compatibility shim.

That the next time you run your application, Windows will emulate the Server 2003 behavior and make the exception disappear.

In order to keep these exceptions (since you want them to happen), add a "I'm designed for Windows 7" manifest entry:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文