Error thrown in Inspector after spell check

Add-in Express™ Support Service
That's what is more important than anything else

Error thrown in Inspector after spell check
 
Adam Toth




Posts: 24
Joined: 2005-03-08
I am using the latest version for VS 2003.

I have an outlook addin which puts two buttons on a Mail Inspector Toolbar. There is no conditional checking or enabling disabling etc, they are just there in any Mail Item.

This works fine except for one scenario, as follows.

1. User Sends a File from a Windows explorer using Send To/Mail Recipient.
2. A New Message comes up in Outlook, fine, with the attachment.
3. User sets TO address and hits send, the Automatic Spell Checker comes up.
4. When the Spell Check is finished and closes the following error occurs:
"Object reference not set to an insytance of an object.
at AddinExpress.MSO.OlInspectorEvents_BaseLogic.DoInspectorActivate()"
5. This error is repeaded as infinitum and you have to kill the Outlook process.

This error is presumably caused by some internal function that I cannot edit - can you reproduce/fix/let me know a work around for this please.

Thanks

Adam
Posted 21 Dec, 2005 09:41:40 Top
Brad Smith




Posts: 49
Joined: 2005-11-22
When you do the Send To, is Outlook already running? While I haven't played much with Send To using ADX, I know from past experience that supporting SendTo is a nightmare.

Try this test, which may provide a clue: repeat steps 1 through 3 except *don't* hit Send yet. Instead, switch focus to some other app, and then back to your message (basically, deactivating and then reactivating the message window). See if you get the same problem. I'm somewhat expecting that you will.

If my theory is correct, what's happening is the OnActivate base logic has a bogus object (the Inspector?). The SpellCheck dialog deactivates the window, and when it's done you get the OnActivate event, which raises the error.
Of course, the error popping up deactivates the inspector, and when you click OK, you get another OnActivate and the cycle continues.

By the same token, when debugging putting a breakpoint in your OnActivate handler will lead to trouble. :-)

Hopefully this will help you provide more info so Sergey can locate and fix the problem. I'm bound to bump into it myself eventually.

Brad.
Posted 21 Dec, 2005 09:53:33 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Thanks for the suggestion. I did try switch focus but the error did not occur. After doing that a couple of times with no error I sent it as before, and the error ocurred as described.

Outlook is already running when the user does Send To. Im not sure how you would not support Send To as it is kind of built in with the OS.


Posted 21 Dec, 2005 10:13:24 Top
Brad Smith




Posts: 49
Joined: 2005-11-22
When I say "support", I'm referring to our add-ins, not ADX itself. I'm only a humble add-in developer like you. I'm in the process of porting my C++ add-ins to C#, but because I need to support the obsolete Outlook versions, I'm using ADX. I'd love to use something like VSTO, but because, unlike MS, we have to work in the real world where our customers use old versions, I'm kinda stuck. Mind you, it's going well so far. :-)

You wouldn't believe the hack code I have in my C++ stuff to work properly with Send To. And Outlook behaves differently for SendTo from Explorer, Word and other apps. I recently spent several days hacking away so that SendTo from Acrobat Reader would work properly (Adobe is doing SendTo in some weird manner). Unfortunately, I don't think switching to C# is going to solve all that, I'm just going to have to reimplement my hacks. Such fun. <sigh>

I wonder, at what point are you doing your Marshal.ReleaseComObject on your Inspector? I could see the behavior you describe possibly occur if you did the ReleaseComObject during the OnSend processing. The Spell Check is done *after* the add-in's OnSend handler, I believe. That might be a clue.
Mind you, if it were that simple you'd be able to reproduce on every message, not just SendTo ones. Hmmm.

Brad.
Posted 21 Dec, 2005 10:37:40 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Yes, Outlook is a real pain to support. :|

I am not actually doing anything in code - it is somewhere inside the ADO code that the error is generated, otherwise I would have hacked it myself!

Can anyone from ADO shed any light on this please?
Posted 21 Dec, 2005 11:20:36 Top
Sergey Grischenko


Add-in Express team


Posts: 7215
Joined: 2004-07-05
Hi Adam.
Hi Brad.

I have just replied you by email. Please check your inbox.
Posted 21 Dec, 2005 19:44:24 Top
Adam Toth




Posts: 24
Joined: 2005-03-08
Thanks. Seems to have worked! :)
Posted 22 Dec, 2005 12:21:16 Top