Book a Demo

Author Topic: Add-In Debugging from VS2010  (Read 7026 times)

JanosK

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Add-In Debugging from VS2010
« on: January 24, 2011, 11:27:38 pm »
Hi all,

I'm back to EA Add-Ins, but the development keeps going on with the Visual Studio 2010.

With the VS2005 and VS2008 i was able to both output debug messages (to the output view) and more importantly to set breakpoints and step through the Add-In code.
This all doesn't work with VS2010 now - and i don't have a clue where the problem might reside.

Are you guys able to actual debug your Add-In code with the Visual Studio 2010 and output messages - and if so, could you perhaps give me any hints so that i could get it to work as well?

I'd appreciate your help!
Cheers
Janosch
« Last Edit: January 24, 2011, 11:28:06 pm by JanosK »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add-In Debugging from VS2010
« Reply #1 on: January 24, 2011, 11:35:44 pm »
Janosh,

I never tried output messages, but I can debug perfectly fine from within VS 2010.
Usually I write a test application to test my functionality. I then disable all addins in EA, and I can rebuild without having to shut down EA.
If I want to do my final tests, I Attach to the process EA.exe and I can debug away.

Geert

JanosK

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Add-In Debugging from VS2010
« Reply #2 on: January 24, 2011, 11:48:16 pm »
Hi Geert,
thanks for your quick reply.

By "Debugging" i meant setting breakpoints and halting&stepping the Add-In whilst it is running inside the EA.
Is that also what you were talking about?

I can start the the Add-In from within VS2010 by attaching to the EA.exe - but i cannot halt&step the Add-In as i could with earlier VS versions. (i do not have proof for this - but i am pretty pretty sure!)

Cheers Janosch

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add-In Debugging from VS2010
« Reply #3 on: January 24, 2011, 11:55:20 pm »
Yes Yanosh,

That is what I meant by debugging.
I never had issues with that in VS2010.

I suppose you compiled in debug mode?

Geert

JanosK

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Add-In Debugging from VS2010
« Reply #4 on: January 25, 2011, 12:03:33 am »
Quote
That is what I meant by debugging.
I never had issues with that in VS2010.
Alright, so it must somehow work for me as well...

Quote
I suppose you compiled in debug mode?
Exactly. I'm running Visual Studio 2010 in administrator mode on Windows 7, 64bit. The EA version is 7.5.
To start the project, i right-click on the project and go "Debug->Start new instance" or "Debug->Step into new instance". Neither of these options work for breakpoints.

I have to admit, that the VS-world is not my world (still... but hoping). Is there maybe some elementary thing that i may have forgotten to set, activate, enable...?
For my colleague, debugging doesn't work either with the common settings under same platform conditions (Win7x64, VS2010).

Thanks a lot for your support.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add-In Debugging from VS2010
« Reply #5 on: January 25, 2011, 12:10:49 am »
When need to debug directly from EA I do following:
- Build my addin project with options "register for Com Interop" to make sure EA will connect to my freshly build dll
- Start EA
- Put my breakpoints where I want the execution to stop
- Use Debug|Attach to Process and choose EA.exe
- Access the functionality of my addin from within EA (context menu or events, or whatever is defined to trigger the addin functionality)
- VS will then stop at my defined breakpoint(s)

Geert

JanosK

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Add-In Debugging from VS2010
« Reply #6 on: January 25, 2011, 12:20:04 am »
Thank you so much Geert!

Quote
- Use Debug|Attach to Process and choose EA.exe
This procedure works for me now too - and even my Diagnostics.Debug.WriteLine() messages are appearing in the Output view again.

Earlier with VS2008 i was using the setting "Start external program" in the project properties, to start the EA.exe with my DLLs. This doesn't seem to work anymore - but anyways, connecting to the existing EA appears to be a much nicer way.

Thanks again for your nice and super-quick help!
Cheers
Janosch
« Last Edit: January 25, 2011, 12:21:24 am by JanosK »

Colin Richardson

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: Add-In Debugging from VS2010
« Reply #7 on: January 25, 2011, 03:02:04 pm »
I had a similar problem, but it boils down to the fact that if you start the EXE at debug time, VS2010 doesn't know what debugger to use, and it picks the wrong one!

To fix this, create an EA.exe.config file in the same location as EA.exe with this content:

<?xml version ="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
  </startup>
</configuration>


Now the start external program way of debugging works again.

~ Colin

JanosK

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Add-In Debugging from VS2010
« Reply #8 on: January 25, 2011, 08:05:32 pm »
Quote
Now the start external program way of debugging works again.
Thank you Colin - this works perfectly well!

Cheers
Janosch