I am using Visual Studio 2012
I have a T4-Template within a project to generate Code from existing Code. For that, i use the Visual Studio Env.DTE-API. The same error as discribed will be thrown in a simple console application, so it cannot be a problem within my project.
For a couple of weeks, all runs fine.
Today a am confronted only sometimes with a exception. The same project runs on a coworkers machine like a charm, no exceptions ever.
That leads me to the assumption that something with my Visual Studio or or my machine in general is provoking this exception, not the project itself.
The exception reads as follow (i cutted it a little bit):
Error 7 Running transformation: System.Runtime.InteropServices.COMException (0x800401E3): Vorgang nicht verfügbar. (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) at System.Runtime.InteropServices.Marshal.GetActiveObject(Guid& rclsid, IntPtr reserved, Object& ppunk) at System.Runtime.InteropServices.Marshal.GetActiveObject(String progID)
The code on which the exception will be throwed reads as follow:
DTE dte = (DTE) Marshal.GetActiveObject("VisualStudio.DTE");
My questions are: Is there generally something wrong or critical with the code i use? And, maybe someone has an idea what could be wrong with Visual Studio or the machine running it.
I have already ran the code sample which can be found on (Marshal.GetActiveObject() throws MK_E_UNAVAILABLE exception in C#), my Visual Studio instances are visible and there in ROT.
Best Regards
It has been observed that you will consistently get this error if a process running with elevated privileges tries to obtain an interface to a process running without elevated privileges, and vice versa.
User contributions licensed under CC BY-SA 3.0