NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NetOffice.OutlookApi.Application.GetActiveInstance() returns strange COM object if XmlSpy is running

robertmuehsig opened this issue · comments

This is propably a strange bug, but one of our customers reported it and I can reproduce it as well.

First:

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:

image

If XmlSpy is not running the result is this:

image

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