You've probably found this article because you were browsing in an Explorer window using Windows Vista. The direct cause of this is probably a video file and its related codec that is inside one of the folders. Often just avoiding "Stack by Type" prevents the problem, but how to fix it entirely?
Stack by Type and COM Surrogate Errors
Now that more people have found the "Stack by Type" option to be very handy in Vista, a new problem is being increasingly experienced. Shortly after sorting a folder with many file types, particularly if some of them are video or media files, an error message appears stating that "COM surrogate has stopped working." Vista offers to ask for help and let you know when it finds some (but this has never worked even once for me).
What's "Stack by type?" It's what you get in an Explorer window when you click the down arrow just to the right of the "Type" column. For example, in the images below (click to enlarge them), I've navigated to my main Bright Hub folder on my PC and clicked on Type → Sort by Type. It's now showing all the different files in the subdirectories in individual stacks.
Codecs and COM Surrogate
As mentioned previously, this error probably happened because Explorer searched, found some video content, and then couldn't find the codecs that went with them. This is situation where multimedia applications are actually smarter than the operating system. They have the sense to find the right codecs (most of the time) and not go looking for them until they are needed. They certainly don't scream "Eeek!" and throw up their hands in defeat.
Or perhaps you weren't using "Sort by type." Perhaps you were viewing thumbnails of media content or simply dragging a media file from one folder to another when the error happened.
What is COM surrogate? It's the method or service that is associated with the file called "dllhost" in your Windows directory. It's what, among other things, tries to connect media files to their codecs so Explorer can select icons or draw the thumbnails.
You might be able to fix the problem by deleting any old codec packs (that show up in Programs and Features in Control Panel) and downloading fresh ones that may be more compatible with Vista. You also may be able to prevent it by upgrading programs that use their own codecs such as Nero and DivX.
But another approach would be to address directly the process that is causing the problem. Oddly, it's not dllhost itself. It's DEP, or data execution prevention. DEP is a security feature in Vista (and Windows XP SP2 and SP3) that prevents applications from executing code from an illegal or non-executable address in memory. Usually this applies to older programs that are not compatible, or at least not fully compatible with Vista. It's also possible that they are not DEP-compliant.
Microsoft gives us the option to turn off DEP globally. That's probably not a very good idea as much of DEP is actually implemented at the CPU level these days, and it is a good security feature. Fortunately, Vista allows us to turn off DEP on a per-application basis as well, so if we prevent DEP's acting on dllhost, then we won't have to worry about COM surrogate crashing, no matter the cause.
Turn Off DEP to Prevent COM Surrogate Errors
I did find some people online saying that this process did not work for them. In case your experience is similar, I suggest that you do try to remove or refresh your codecs, or try a different application for your CD/DVD burning or authoring program.
That said, here's how to turn off DEP for COM surrogate.
Right-click Computer and select Properties.
Click "Advanced system settings" as shown above.
In the System Properties dialog, click the "Settings" button in the Performance section.
Click to select "Turn off DEP for all programs and services except those I select" and click the "Add" button.
It should open in your System32 folder. Begin to type in
and it should match and offer "dllhost.exe."
Vista will object somewhat weakly. (Weakly, that is, when compared to a full-screen-darkening UAC prompt.)
Click away the warning, and you'll see that COM surrogate is now added to the DEP ignore list.
Click OK to close the Performance Options dialog, click acceptance to the dialog that warns you that a restart is needed, and then click OK to close System Properties.
You've arrived! After restarting your computer you should be able to view media thumbnails, copy videos, and use "Stack by type" without COM surrogate errors.
I hope this has helped you resolve your COM surrogate issue and that you didn't have to spend a lot of time tracking down and replacing codecs and applications. Thank you for reading this, and thank you for visiting Bright Hub.