Author Topic: debuging  an add-in from vs.net  (Read 5518 times)

Marco Zapletal

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
debuging  an add-in from vs.net
« on: August 31, 2005, 01:43:16 pm »
folks,

can somebody give me a hint, how to attach a debugger from vs.net to an EA addin?
till now, i wrote testclasses for my code and started them from vs.net in debug mode. but sometimes it would be helpful to debug the addin directly in EA.

i hope i put my question clearly ;-)

thanks,
marco
« Last Edit: August 31, 2005, 01:44:51 pm by marco4712 »

TomO

  • EA Administrator
  • EA User
  • *****
  • Posts: 80
  • Karma: +7/-0
  • EA - Bridging the gap between Business and IT
    • View Profile
    • Sparx Systems
Re: debuging  an add-in from vs.net
« Reply #1 on: August 31, 2005, 07:24:50 pm »
Hey Marco,

I have just developed an Add-In here:  
C# How to create a Basic Add-In
http://sparxsystems.com.au/resources/developers/autint.html

It has documentation on how to setup VS2003 so you can run your Add-In and EA at the same time while debugging. I hope it helps!

Best Regards
TomO
« Last Edit: August 31, 2005, 07:26:10 pm by TomO »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: debugging  an add-in from vs.net
« Reply #2 on: August 31, 2005, 07:52:23 pm »
Hi Tom,

that Add-In stuff looks good!

However, I have an Add-On, not an Add-In (that is a Windows Application that references the EA AI).  I haven't been able to debug EA objects.  I looked through what you wrote in the ReadMe in case there was something there that I had missed (I'm new to C# and .Net).  

I found Register for COM Interop set to False in the Windows app (greyed out) and also set to False, but changeable in the main Component that does most of the work of accessing the AI.  So I set that to True.

However, no change?   :(

When I try to "watch" the attribute such as eaPackage.Name, I get the error: "eaPackage.Name" does not exist.  (However, I obviously can use it and assign it.)

Any advice for my situation?

Cheerz,
Paolo
« Last Edit: August 31, 2005, 07:53:08 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

TomO

  • EA Administrator
  • EA User
  • *****
  • Posts: 80
  • Karma: +7/-0
  • EA - Bridging the gap between Business and IT
    • View Profile
    • Sparx Systems
Re: debugging  an add-in from vs.net
« Reply #3 on: August 31, 2005, 09:13:54 pm »
Quote
When I try to "watch" the attribute such as eaPackage.Name, I get the error: "eaPackage.Name" does not exist.  (However, I obviously can use it and assign it.)


Hey Paolo,
Actually there is a way to "watch" that attribute. You will notice in the watch area if you just add eaPackage you will get a value of {EA.PackageClass} and a type of EA.Package. Because of the nature of this relationship you can't just ask VS to watch eaPackage.Name as Name is not a member of Package, its a member of PackageClass.

To view the eaPackage.Name attribute expand your "watched" eaPackage, open the EA.PackageClass find the name attribute and "drag it out of PackageClass" you will now find a new watch element called ((EA.PackageClass)(eaPackage)).Name with the value you are after.  

In short using the C# notation, you are casting eaPackage (of type EA.Package) to type EA.PackageClass so you can then access the attribute.

I hope this helps Paolo
Best Regards
TomO

Marco Zapletal

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: debuging  an add-in from vs.net
« Reply #4 on: August 31, 2005, 11:43:30 pm »
its working...thanks a lot for your hints tom.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: debugging  an add-in from vs.net
« Reply #5 on: September 01, 2005, 12:22:45 am »
Quote

Hey Paolo,
Actually there is a way to "watch" that attribute. [size=13][SNIP][/size]

In short using the C# notation, you are casting eaPackage (of type EA.Package) to type EA.PackageClass so you can then access the attribute.

I hope this helps Paolo
Best Regards
TomO
Hi Tom,
I understand what you are trying to do with the cast, but when I put in:
((EA.PackageClass)(eaPackage)).Name
I get:

((EA.PackageClass)(eaPackage)).Name
   <error: an exception of type: {System.ArgumentException} occurred>    
string

???
Paolo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Marco Zapletal

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: debugging  an add-in from vs.net
« Reply #6 on: September 01, 2005, 01:28:28 am »
Quote

Hey Paolo,
Actually there is a way to "watch" that attribute. You will notice in the watch area if you just add eaPackage you will get a value of {EA.PackageClass} and a type of EA.Package.


sometimes if have this type/value construct you describe, but often my objects have {System.__ComObject} as value. may someone has an explanation for me? ;)

TomO

  • EA Administrator
  • EA User
  • *****
  • Posts: 80
  • Karma: +7/-0
  • EA - Bridging the gap between Business and IT
    • View Profile
    • Sparx Systems
Re: debugging  an add-in from vs.net
« Reply #7 on: September 01, 2005, 05:21:59 pm »
Quote
I understand what you are trying to do with the cast, but when I put in:
((EA.PackageClass)(eaPackage)).Name
I get:

((EA.PackageClass)(eaPackage)).Name
    <error: an exception of type: {System.ArgumentException} occurred>    


I think the easiest way to do it, although it's a little slower, is to place the parent object in first, in this case just a watch on eaPackage. From there you can drill down to the actual attribute you wish to view, and drag it out on its own, vs.net will do all the conversion for you.

TomO
« Last Edit: September 01, 2005, 05:23:11 pm by TomO »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: debugging  an add-in from vs.net
« Reply #8 on: September 06, 2005, 09:13:16 pm »
Quote

I think the easiest way to do it, although it's a little slower, is to place the parent object in first, in this case just a watch on eaPackage. From there you can drill down to the actual attribute you wish to view, and drag it out on its own, vs.net will do all the conversion for you.

TomO
Hi Tom,

I've been trying your suggestion and only once in 3 days did it work. :(  Unfortunately, when it did I was so shocked :o, I didn't note the circumstances.

Any other ideas?

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!