AnsweredAssumed Answered

IDocumentEvents that take a return value do not seem to work properly in ArcMap 10.1.

Question asked by z001392 on Jan 20, 2016
Latest reply on Jan 26, 2016 by z001392

Hi,

 

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.

Outcomes