Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i fix Win7 app compatibility shim with 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.

like image 886
Scott Wylie Avatar asked Apr 08 '11 21:04

Scott Wylie


People also ask

How do I make an application compatible with a shim?

To create a shim browse to the yellow drum symbol, right click and choose to create a new Application Fix. In this dialog type in your application name. Vendor Name and then browse to the .exe with the issue. If you would like to use a compatibility mode you can select it here.

What is application shimming?

Application shimming is a Windows Application Compatibility framework that Windows created to allow programs to run on versions of the OS that they were not initially created to run on. Most applications that used to run on Windows XP can today run on Windows 10 due to this framework.

What is shim Microsoft?

In computer programming, a shim is a small library which transparently intercepts an API, changes the parameters passed, handles the operation itself, or redirects the operation elsewhere. Shims can also be used for running programs on different software platforms than they were developed for.

What is shim in application packaging?

A shim is an . sdb file which you install along your applications. These can also be used with virtual applications but needs to be installed and live on the local machine and not within the virtual application itself.


1 Answers

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>
like image 88
Ana Betts Avatar answered Oct 08 '22 20:10

Ana Betts