I am trying to create "A Package Dependencies" Diagram using C#.
EA.Package pack = m_eaResp.GetPackageByGuid(packageGUID);
EA.Connector con = (EA.Connector)m_package.Connectors.AddNew("Test Import", "");
con.SupplierID = pack.Element.ElementID;
con.Update();
The Update() function raises a COMException:
A COMException was raised after the con.Update() was executed.
Exception detail:
COMException was unhandled
The server threw an exception.( Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
StackTrace:
" at EA.IDualConnector.Update()\r\n at EADemo.Form1.ConnectorTest() in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 274\r\n at EADemo.Form1.btnDoIt_Click(Object sender, EventArgs e) in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 200\r\n at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n at System.Windows.Forms.Button.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at EADemo.Form1.Main() in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 151\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
Is this the correct way to create a connector for a package? Are there some other way to create it?
Thank you very much!