Stefan P?tz
Posts: 3
Joined: 2022-07-19
|
Dear all,
we are using the Outlook Securitymanager in the newest Version in our C# project. So here is our code:
public MailScanner()
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
this.securityManager1 = new AddinExpress.Outlook.SecurityManager();
oApp = null;
OutlookApp = null;
if (Process.GetProcessesByName("OUTLOOK").Count() > 0)
{
oApp = Marshal.GetActiveObject("Outlook.Application") as Application;
}
else
{
oApp = new Application();
}
securityManager1.ConnectTo(oApp);
securityManager1.DisableOOMWarnings = true;
...
The program runs in a loop and creates a new MailScanner object each time. So the program runs fine at first. But after a while we get an System.NullReferenceException when calling securityManager1.DisableOOMWarnings = true;
At the moment we do not do this after each loop:
finally {
manager.DisableOOMWarnings = false;
manager.Dispose();
}
Is it needed?
As this does only happen after a while we are bit stuck for finding the problem. Maybe someone can help out. |
|
Andrei Smolin
Add-in Express team
Posts: 19120
Joined: 2006-05-11
|
Hello Stefan,
Try to use 1) manager.DisableOOMWarnings = false and 2) securityManager1.Disconnect(oApp). I can't explain securityManager1 being null. Is this a one-thread application?
Regards from Poland (CEST),
Andrei Smolin
Add-in Express Team Leader |
|
Stefan P?tz
Posts: 3
Joined: 2022-07-19
|
Hello Andrej,
thanks for the very fast reply. We will try it. Yes it is a one threaded app.
Best regards,
Stefan |
|
Stefan P?tz
Posts: 3
Joined: 2022-07-19
|
Hello Andrej,
your hint regarding the threads pointed us to the right direction. We found some functionality in the application which was threaded. So sometimes our objects blew up. :-)
Thank you very much for your support. You can close this topic as resolved. |
|
Andrei Smolin
Add-in Express team
Posts: 19120
Joined: 2006-05-11
|
Thank you, Stefan!
Regards from Poland (CEST),
Andrei Smolin
Add-in Express Team Leader |
|