I have custom extension code which listens for a variety of events, including IDocumentEvents . While all events fire correctly, those expecting a return value do not seem to handle the return values correctly.
In order to try and prove the issue I decided to write a simple Add-in to test this. So having used the templates in VS2010 C# and .Net 4, I have created a simple Extension Add-in for ArcMap 10.1, essentially writing very little code but simply commenting in the default 'WireDocumentEvents' code which listens for and responds to BeforeCloseDocument. BeforeCloseDocument should abort the closing of ArcMap when TRUE is returned, however having displayed and responded to the message dialog the document behaves the same and closes whether TRUE or FALSE is returned. This confirms the behaviour from my custom extension code.
I have also found similar behaviour with ArcMap ignoring the return value with the OnContextMenu event and I think now I can also attribute some previous issues I have had with IEditEvents similarly.
Is anyone aware if this is a documented error with ArcMap 10.1 or indeed does anyone have these events working? They do work in VBA but the signatures are different and VBA is not a viable coding alternative for me, it was used simply as a test.
Appreciate any feedback.