Using ADXMAPIStoreAccessor with asynchronous notifications

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

Using ADXMAPIStoreAccessor with asynchronous notifications
 
Paul Cross




Posts: 110
Joined: 2008-06-07
Hi,

I'm using the ADXMAPIStoreAccessor with asynchronous notifications - create in the following way:

ADXMAPIStoreAccessor mapiStoreAccessor = new ADXMAPIStoreAccessor { SupportedStoreEvents = ADXMsgStoreEvents.CriticalError | ADXMsgStoreEvents.NewMail | ADXMsgStoreEvents.ObjectCreated | ADXMsgStoreEvents.ObjectMoved };
mapiStoreAccessor.Initialize(false);
mapiStoreAccessor.AsyncInterval = 1000;
mapiStoreAccessor.AsyncNotifications = true;

If I exit Outlook after clicking Send/Receive (without waiting for Send/Receive to complete) I occasionally receive the error below (trapped in OnCurrentDomainUnhandledException).

System.NullReferenceException: Object reference not set to an instance of an object.
at AddinExpress.MAPI.ADXMAPIStoreAccessor.AbortHasRequested(ArrayList arrList)
at AddinExpress.MAPI.ADXMAPIStoreAccessor.ThreadProc()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

.NET Reflector shows that the AbortHasRequested method has no try/catch

private void AbortHasRequested(ArrayList arrList)
{
if (arrList.Count > 0)
{
arrList.Clear();
}
Monitor.Enter(this._notificationsList.SyncRoot);
if (this._notificationsList.Count > 0)
{
this._notificationsList.Clear();
}
Monitor.Exit(this._notificationsList.SyncRoot);
}

This error does not occur if I use ADXMAPIStoreAccessor with synchronous notifications...

Any thoughts as to possible workarounds (other than catching the NullReferenceException in OnCurrentDomainUnhandledException)?

Thanks,
Paul
Posted 05 Mar, 2010 06:40:23 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Paul,

Thank you for pointing this to me. I have fixed this. Please try installing a new build of the MAPI Store Accessor.
.NET, Extended MAPI, Windows Phone & RT
Posted 07 Mar, 2010 09:49:40 Top
Paul Cross




Posts: 110
Joined: 2008-06-07
Thanks Eugene, I'll try the new build tonight.
Posted 08 Mar, 2010 12:25:56 Top