WCF forms and TargetInvocationException

WCF forms and TargetInvocationException

Anonymous
Not applicable
1,299 Views
7 Replies
Message 1 of 8

WCF forms and TargetInvocationException

Anonymous
Not applicable

I am now getting a TargetInvocationException caused by the following I think.

 

System.TypeLoadException

Method 'get_Item' in type 'Autodesk.AutoCAD.Geometry.Point3dCollection' from assembly 'Acdbmgd, Version=18.2.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

 

Am referencing the ARX2012 SDK inc directory. Have tried several versions of the SDK back till 2010. All appear to give the same error. If I remove the AcDbMgd and AcMgd, the problem appears to go away, so assume that these dll are to fault  

I thought the dll in the ARX SDK where xaml designer friendly, any ideas anyone. All worked well a few days ago, so did system restore to roll back any updates, but that failed to correct it.

  

Have spent several hours trying to solve this, so hope some ideas from this forum might get this resolved

0 Likes
Accepted solutions (1)
1,300 Views
7 Replies
Replies (7)
Message 2 of 8

norman.yuan
Mentor
Mentor

Where does the code run, on the WCF service side or WCF client side? What is "WCF forms"?

 

If it is WCF service, where it is hosted? If the WCF service is not hosted inside your AutoCAD, then you cannot use AutoCAD .NET API (acdbmgd.dll and acmgd.dll) in a application outside AutoCAD. Period.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 8

Anonymous
Not applicable

Sorry, Its WPF and its a user control which is placed into a WPF window.

0 Likes
Message 4 of 8

norman.yuan
Mentor
Mentor

Where the WPF form is used? Inside AutoCAD as modal or modeless dialog box, or in a stand-alone WPF app? If it is latter, you cannot use AutoCAD API DLLs, as I said in previous reply.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 8

Anonymous
Not applicable

 

It’s a modal window called by Autodesk.AutoCAD.ApplicationServices.Application.ShowModalWindow() all run within autocad. What I have noticed is that it is very temperamental, sometimes it works ok in the VS2010 designer, do the same actions again and get the message. Also tried on another PC, even stranger, it has no problems. So copied the two *mgd.dll to the problem PC and referenced them, still the problem. Ran repair on VS2010, still the problem. Remove the *mgd.dll and re-add, all works, rebuild and the problem is back. Both PC where 64 bit. The only difference was that on VS2010 is Pro the other was ultimate.  

Started new solution and copied the source code over to new project, still the problem. Have now ran out of ideas.

0 Likes
Message 6 of 8

norman.yuan
Mentor
Mentor

Do you set "Copy Local" of the 2 references (to acdbmgd.dll and acmgd.dll) to False? (everyone doing Acad .NET deelopment should know this. But seeing you said "copied the two...,  thus I wonder...).

 

Of course you sure use the same version of of the 2 dlls from SDK as the AutoCAD installed in the box where you do your coding.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 8

Anonymous
Not applicable

Yep they are set to false, and they are the correct dll, just set up a project on problem PC using VS2008, this is working OK, so its something about the VS2010.

0 Likes
Message 8 of 8

Anonymous
Not applicable
Accepted solution

 

OK, finally fixed it, downloaded a Visual Studio 2010 removal tool form Microsoft. Reinstalled the VS2010, selected General setting on first time run. Cannot reproduce the problem after 5 min’s of clicking, file opening and re-building.

Have not installed service pack 1, as original copy had this and don’t want to try my luck.

0 Likes