C
Corinna John
We have an .NET service (written in C#, running in the
LocalService account), which impersonates an account,
opens a CDO session and then reads/writes mails and tasks
from/to folders only accessible by the impersonated user.
If the service calls windowsImpersonationContext.Undo()
after the CDO session has logged on, it usually can read
public folders and their content without a problem. But
every once in a while (average after 20 objects have been
read), it throws a System.NullReferenceException at
System.Runtime.InvokeDispMethod.
If the service does not undo the impersonation and runs in
the account which is logged on to Exchange, the
NullPointerException is thrown exactly when the fourth CDO
object is retrieved. I have already tried opening a new
session before opening a folder, but then the Exception is
thrown while logging on the fourth session.
If the fourth action is reading the contents of a folder,
the NullreferenceException occurs in
MAPI.Folder.get_Messages().
If I try to read a message, it occurs in
MAPI.Message.get_Text(), MAPI.Message.get_Attachments() or
another get-method.
Here is a typical stack trace for reading message
properties:
System.NullReferenceException: Der Objektverweis wurde
nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers, CultureInfo
culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[]
aWrapperTypes, MessageData& msgData)
at MAPI.Message.get_Attachments()
at Vita.Bk.SecureItem.CopyFrom(Message message)
And here is a typical stack trace for listing folder items:
System.NullReferenceException: Der Objektverweis wurde
nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers, CultureInfo
culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[]
aWrapperTypes, MessageData& msgData)
at MAPI.Folder.get_Messages()
at
Vita.Bk.OutlookService.OutlookService.ListUserTodoItems
(Object[] parameters) in c:\visual studio-projekte\mba
kataster\outlookservice\outlookservice.cs:line 529
That is how the service behaves on .Net Framework 1.0
without service packs. I have installed Service Pack 2,
now the NullReferenceExceptions always occur at random, no
matter if the service is still impersonating a user or not.
The "Outlook EMail Security" stuff has been configured to
allow all MAPI and CDO actions, but there is still no
change,
the CDO objects are throwing Exceptions after a while.
Does anyone know what happens here? Is is a problem of CDO
or .NET Interop?
Thank in advance,
corinna
LocalService account), which impersonates an account,
opens a CDO session and then reads/writes mails and tasks
from/to folders only accessible by the impersonated user.
If the service calls windowsImpersonationContext.Undo()
after the CDO session has logged on, it usually can read
public folders and their content without a problem. But
every once in a while (average after 20 objects have been
read), it throws a System.NullReferenceException at
System.Runtime.InvokeDispMethod.
If the service does not undo the impersonation and runs in
the account which is logged on to Exchange, the
NullPointerException is thrown exactly when the fourth CDO
object is retrieved. I have already tried opening a new
session before opening a folder, but then the Exception is
thrown while logging on the fourth session.
If the fourth action is reading the contents of a folder,
the NullreferenceException occurs in
MAPI.Folder.get_Messages().
If I try to read a message, it occurs in
MAPI.Message.get_Text(), MAPI.Message.get_Attachments() or
another get-method.
Here is a typical stack trace for reading message
properties:
System.NullReferenceException: Der Objektverweis wurde
nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers, CultureInfo
culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[]
aWrapperTypes, MessageData& msgData)
at MAPI.Message.get_Attachments()
at Vita.Bk.SecureItem.CopyFrom(Message message)
And here is a typical stack trace for listing folder items:
System.NullReferenceException: Der Objektverweis wurde
nicht auf eine Objektinstanz festgelegt.
at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers, CultureInfo
culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[]
aWrapperTypes, MessageData& msgData)
at MAPI.Folder.get_Messages()
at
Vita.Bk.OutlookService.OutlookService.ListUserTodoItems
(Object[] parameters) in c:\visual studio-projekte\mba
kataster\outlookservice\outlookservice.cs:line 529
That is how the service behaves on .Net Framework 1.0
without service packs. I have installed Service Pack 2,
now the NullReferenceExceptions always occur at random, no
matter if the service is still impersonating a user or not.
The "Outlook EMail Security" stuff has been configured to
allow all MAPI and CDO actions, but there is still no
change,
the CDO objects are throwing Exceptions after a while.
Does anyone know what happens here? Is is a problem of CDO
or .NET Interop?
Thank in advance,
corinna