Outlook developer Ken Slovak has been working with Microsoft to determine the cause of a bad crash in Outlook 2007 (and hangs on Outlook 2003) caused by Apple's ITunes add-in for Outlook which is used for calendar synching with IPods. Ken felt our readers would find this information useful and interesting.
Because other vendors are using the same method ITunes uses, there are other add-ins which will need to be fixed. We're hoping by publishing the problem, vendors will check their code and address the problem.
From Ken: "According to a Microsoft support engineer, Outlook was designed to assume that all calls to the Outlook object model are on thread 0. Some other often used DLL's also make that assumption, such as the VB 6 runtime (MSVBVM60.DLL) which is used in many of the Outlook add-ins currently available.
Apple sets up a new thread using a named pipe to do the calendar synching but neglected to marshal the thread back to thread 0 for any calls to the Outlook object model and calls into the object model instead on thread 7. This lack of a proxying back to thread 0 then sets Outlook to call into MSVBVM60 to pass along any events that have fired due to the object model access (for example the ItemLoad event available only in Outlook 2007, which fires on every object model access to any Outlook item). This crashes Outlook due to the threading. The stack is read by Watson and whatever is at the bottom of the stack gets blamed for the crash, usually MSVBVM60 but also Kernel32 on Vista. The next time Outlook starts up, whichever add-in was listed lowest in the stack is blamed for the crash.
If no VB6 add-in is running then Outlook doesn't immediately crash, instead it becomes unstable and might crash at any later time, or it might just get hung in a deadlock between threads, something that won't happen if all calls to the object model are called in thread 0.
There is no possible defensive programming an add-in can do to prevent another add-in from causing this problem. The problem add-in must change its code to prevent the problem from occurring."
Ken's contact at Microsoft is in touch with Apple about the problem and we fully expect Apple to fix the problems. However, other vendors are also doing the same thing and causing problems, so this is a vendor by vendor problem that needs to be addressed each time an offending add-in is discovered.
Ken adds "One way users can figure out which add-in is causing the crashes is to disable all add-ins except the one being blamed for the crash, then re-enable them one by one and waiting for the crash to occur. When it does, you know which add-in caused it. Getting the vendor to fix the problem may be more difficult."
Steve Griffin plans to write about the problem on his blog and will eventually get the information into the new Outlook 2007 Auxiliary Reference documentation, which is the best the site to visit to reference best practices and to aid developers whose add-ins are incorrectly being blamed for crashes. Microsoft may contact vendors who show up in the Watson bucket crashes; Steve has already identified at other vendors, aside from Apple, who are showing up in those buckets.