Context menu shell extensions causing Explorer crash on Vista..help please..

Hi everybody,

Upon developing a .net application which has to have support for Vista and , at some point plays with some context menu shell extensions, i experienced a very very weird problem..Here is the situation:
The application was developed for .net framework v1.1.4322. It has to dinamycally create some context menu extensions for folders so, the class responsible with the context menu logic implements IShellExtInit interface, IContextMenu interface and offers implementation for all the methods of the interfaces..All the rules are correctly respected (like keywords for "mirroring" the COM interface by the .NET one, the interface and the implementing class GUIDS, the assembly registered for COM upon instalation, assembly strong named and registered to the GAC etc..) and everything went perfect on the previous platforms prior to Vista.
When running on Vista Ultimate edition, my application's code handling some "dynamically inserted" context menu item will also be reached OK upon using an item, the behavior is OK but the windows Explorer will simply crash each time, not when a certain folder is right-clicked and Shell calls the QueryContextMenu() method of the interface, but when clicking the item (Explorer.exe process stops working and restart...) The error description from EventViewer is as following:

"Faulting application Explorer.EXE, version 6.0.6000.16386, time stamp 0x4549b091, faulting module ntdll.dll, version 6.0.6000.16386, time stamp 0x4549bdc9, exception code 0xc0000374, fault offset 0x000af1c9, process id 0xcb8, application start time 0x01c730f5b7e08cdc."

The same problem is encountered when running the application on framework 2.0 and the same version of Vista, no other framework versions present on system (from what I understood, the "on-board" CLR on Vista is still v2.0, though it mentions Framework v3.0- framework v2.0 + WCF, WWF..)

Can anyone please give me a clue on this ...I've tried everything I could and still nothing...I have also tried supplying no code for the InvokeCommand() method of the IContextMenu interface in my COM exposable class but explorer will still crash each time upon using a certain inserted context menu item

Thanks very much!


Answer this question

Context menu shell extensions causing Explorer crash on Vista..help please..

  • Deming

    Exception code 0xC0000374 is new for Vista. It means STATUS_HEAP_CORRUPTION. Good luck fixing that one! You also really need to read this thread.


  • poita

    It is not likely that the crash is related to the framework version number. Heap corruption problems are *very* difficult to debug, most of all because they are usually detected way past the point where the corruption occurred. Having it occur in Explorer makes it so much harder still. MSFT is always improving the heap manager and it is quite likely that the problem has always been there.

    You have no effective defense against the CLR version injection problem. You'll get the version of whatever add-in starts running first. Targeting .NET 2.0 actually makes it worse for you, your add-in might get loaded into a process that has already loaded .NET 1.1. Targeting .NET 1.1 makes it worse for both the process and any other add-ins. To add to the problem, .NET 3.0 is already shipping and .NET 3.5 is on the horizon. They will add lots of classes that your .NET 2.0 add-in will kill off. It is an ugly problem and you better stay away from it if you enjoy restful sleep for the next couple of years.

    On a lighter note: do you have a buddy called Obelix


  • dki

    Well, I tried to talk you out of it but clearly failed. It is pretty unlikely that your .NET code caused the heap corruption problem. First thing to look for is any unmanaged code you might use in your extension handler. Carefully screen any C++ "new" or "delete" calls you use. If you use any 3rd party code, it is suspect as well; more so because you can't see what it does. Of course, you simply may have triggered a bug in the Vista shell code with your extension. Not unlikely, considering how long it has been around.

    The only effective way to get to the bottom of this is to call MSFT Support. Pay the fee and, with some elbow grease and (important!) you refusing to go away, your problem gets bumped up the food chain and you'll get a hold of somebody that really knows what is going on, a member of the Shell team. Last time I did this it took 6 weeks. They'll ask you to send your shell extension and they'll have the tools and debuggers to find out what is wrong. If it is MSFT's problem, you'll get your fee refunded. Hopefully with a workaround, otherwise with a vague promise that it will get fixed in the next service pack. If you're lucky, it is your problem and they'll tell how to fix it.


  • Troy Magennis

    The most recent thing I've found on this issue makes the problem even stranger...:

    Everything is OK, explorer won't crash if a context menu item is selected by right-clicking a certain folder from the navigation panel (the one from the left, displaying the folder in a tree-view) and not from the main one..If the folder is right clicked from the main panel of explorer, this will crash each time upon using a context menu item...Any clues pleaseeee

  • _target_

    Thanks a lot for your reply.

    However, I've already read the thread and I was familiar with the in-process shell extensions handled by managed code risk...But the question is..Could this apply in my case I mean, as mentioned, I've used my assembly on v2.0 framework on Vista (no other version present on the machine) and the problem was the same..As I understood, the CLR version on Vista is still 2.0 so, just theoretically, some race between different versions of the CLR "injected" to explorer couldn't be possible (supposing explorer will load by default the CLR on Vista upon this kind of operations on folders)..Also it's true that the assembly is built on v1.1 framework but, as some Microsoft specification announced, a certain assembly will try to target by default the CLR version it was built on but, if this is not present, "will be pushed forward" if a more recent version is present..

    Maybe I should also try building the assembly on framework 2.0 This wasn't possible until now due to some administartive reasons in our firm..but I think it worths trying...What do you think

    Thanks very very much!


  • cderose

    An explanation about why the whole decribed operation won't cause heap corruption in explorer if the item is a folder from the left pane displayed (tree view) also has to exist...

    I mean, can you please give me a briefly idea about what's the low-level difference betwen these 2 kinds of item organization in Vista's Shell (left pane causing no problems and the main one being a pain..) in the context that I've mentioned : my class implements IContextMenu and IShellExtInit and offers an implementation for all the methods, basically the classical, typical way of "adding dynamic context menu extensions" (Initialize Shell, QueryContextMenu() for decisions about what should be added for some folder's certain state, InvokeCommand() for launching the handler for a certain menu item etc.)..and everything worked perfect for the previous Shells...

    Thank you very much!

    PS: Obelix doesn't have so much questions as I am...


  • Context menu shell extensions causing Explorer crash on Vista..help please..