NullReferenceException in PopupMenuItem


I get a NullReferenceException when I show a Child Window on an event that's chained through the popup menu. I'm not sure that I'm not doing something incredibly stupid. Basically I have a helper that creates a menu with typed-generic methods for things like 'Export via MEMBER' and such. Anyway, when I get the 'done' event back from the service reference and try to open a Child Window this throws an exception for every item that was in this list. It could be a race condition on my end as the menu is also re-built based on the return of that service reference call...

Anyway, I had the source and changingthis on line 465 of PopupMenuItem.cs:
this.Container.IsEnabled = this.IsEnabled; // Sync the container state.

if (this.Container != null)
this.Container.IsEnabled = this.IsEnabled; // Sync the container state.
seems to make the issue go away. I'm not sure the implications. Sorry, I'm lazy. :) It seems to me it's trying access methods from the container when it's been disposed.

Also of note: A MessageBox.Show() will not cause the same issue. I managed to get the exception to go away with the dubugger attached via calling the code to build the menu later than the place I'd like to. The exception presented again in release to the dev sever. :(

Sorry if this wasted someone's time. Thanks for reading!