1

I have a C# program that is using some COM objects available through a tool installed on the machine (Waters Empower 3). Initially when I made the calls I received errors about un-registred classes so I registered the dlls that I am using. Now I get the error below.

System.Runtime.InteropServices.COMException (0x8004020D): Cannot modify or delete an object that was not added using the COM+ Admin SDK (Exception from HRESULT: 0x8004020D)

I'm on a 64 bit windows 7 pro machine. I believe the installed tool is 32bit. I get the error when running the project from VS2013 in 32bit mode.

The exception occurs when I instantiate one of the objects. Specifically

Project proj = new Project();

I'm using the MilTk.dll and MtkCtrl.dll from the Waters Empower toolkit that are registered as COM objects on the system.

The full text of the exception is: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in TestResultsExporter2.exe

Additional information: Cannot modify or delete an object that was not added using the COM+ Admin SDK (Exception from HRESULT: 0x8004020D)

Joe W
  • 2,773
  • 15
  • 35
  • Would you be able to provide any more details on what COM objects you're using, and what is causing the exception? – krillgar Feb 15 '14 at 21:49
  • Added some more notes about the specific DLLs that are registered. The Com object shows up as Waters Empower Toolkit 2.3 Object Library. Now I'm wondering if I somehow un-registered something that was added at install and now hasn't re-registered as expected. – Joe W Feb 15 '14 at 22:08
  • @JoeW Kind of off topic, but how do you actually register the MilTk dll files in VS2013? I keep getting the same type of error seen here http://stackoverflow.com/questions/3456758/a-reference-to-the-dll-could-not-be-added – horriblyUnpythonic Apr 08 '15 at 22:33
  • @horriblyUnpythonic I just used the windows registration utility. Then I followed the instructions to add a normal COM object to a C# project. http://stackoverflow.com/questions/4897685/how-do-i-register-a-dll-file-on-windows-7-64-bit – Joe W Apr 10 '15 at 02:29
  • Even a few years later: In VS2012 I simply added the `MilTk.dll` as a reference to the project. Then I was able to use it. VS is creating the Interop stuff on its own. But working with the `MilTk.dll` in general isn't easy at all! – FredM Nov 08 '18 at 16:03

0 Answers0