如何使用 DISABLEUSERCALLBACKEXCEPTION 修复 Win7 应用程序兼容性垫片
我有一个非常大的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
彻底阅读这篇博文,我已经解释了整个事情:
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 设计的”清单条目:
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: