MS PRoject add-in stops responding

A

Alex

I created Shared Add-in using VS 2005 Shared Add-in template. (C#) It inserts
its own menu in MS Project 2003 menu bar. One menu item ("Options") shows
Windows Form with PropertyGrid in it. Clicking 2-3 times on options and
closing options form eventualy makes custom menu stop working at all. It
looks like my Add-in gets completely unloaded. After I restart MS Project
2003 and it starts working again, until it stops again after 2-3 Options
dilog shows.

All other custom menu items just display MessageBox for me (testing...).
Those menu items do not break anything.

Any suggestions? Can I use Forms with Add-ins at all? Or it is just
PropertyGrid problem?
 
D

David Thielen

Hi;

There are two things I can think of:

1) Are your menu object global? If they are not, once they go out of scope
they will be garbage collected and the menu event will be disconnected from
the menu item.

2) I have found in Word that it will drop the menu -> event connections
under some circumstances, usually when closing a document. The Add-In is
still loaded and running, but the menu connection is gone. I have found in
this case calling the Enable property on the menu will throw an exception in
this case, so I call that and in the catch, re-attach the menus.
 
A

Alex

Thanks a lot, David!

The (1) really worked for me. I created my Add-in popup menu
(CommandBarPopup) locally. It definetly was garbage collected at some point.
What I was thinking about... :-D After I made menu object and all its menu
items as addin class fields it stoped breaking! Great advise!

Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top