NetOffice.OutlookApi.Application.GetActiveInstance() returns strange COM object if XmlSpy is running
robertmuehsig opened this issue · comments
Robert Muehsig commented
This is propably a strange bug, but one of our customers reported it and I can reproduce it as well.
First:
- Install XmlSpy (https://www.altova.com/xmlspy-xml-editor)
- Run XmlSpy
- Start Outlook
- Run a sample application with code like this:
var app = NetOffice.OutlookApi.Application.GetActiveInstance() ?? new NetOffice.OutlookApi.Application();
var mail = app.CreateItem(OlItemType.olMailItem) as MailItem;
- Exception like this is produced:
--> [exception #1] NetOffice.Exceptions.MethodCOMException: Failed to proceed Method on Outlook.Application=>CreateItem.
--> [exception #2] System.Runtime.InteropServices.COMException: Unbekannter Name. (Ausnahme von HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
It seems that the "GetActiveInstance" returns something "broken" if XmlSpy is running:
If XmlSpy is not running the result is this:
I have no idea why XmlSpy (a completely separat application) has such an effect on our application and on NetOffice.
Our workaround now is, that we check if the ActiveInstance
is broken or not and if yes, we return a new Application
object.
My main question would be: Any idea why GetActiveInstance
might return something strange?
Best regards,
Robert