How to Debug a .NET Addin effectively under Visual Studio 2010

How to Debug a .NET Addin effectively under Visual Studio 2010

sn
Participant Participant
1,111 Views
2 Replies
Message 1 of 3

How to Debug a .NET Addin effectively under Visual Studio 2010

sn
Participant
Participant

Actually I start to develop my Inventor Addins under Visual Basic 2010 Professional for 64 bit Inventor, because there is no way around to go further with Visual Basic 6.

So i started up with Visual Studio 2010 Professional at a Windows 7 Ultimate x64 operating system, to realize first that there is no possibility to make any changes on your source on x64 operating systems.

Then i installed everything new on Windows 7 x86 and start to develop there first and recompile it later for the x64 system.

 

I thought after nearly 10 years of .NET development it will not be a problem to to easily debug my addin.

In Visual Studio 6 it was no problem to change your source code when an error occur, and go further with debugging from the pause-mode by pressing "F5" key (Run Button).

For bigger changes i was able to unload the Addin only in Inventor and stop the debugger in Visual Studio 6. To go further with debugging i need only to press the "F5" key again and reload the Addin in Inventor. For loading and unloading the addin i wrote a VBA macro and attached it to a toolbar button.

So i needed to switch between debugging and editing about 5 seconds in Visual Basic 6.

 

Now with .NET i try to attach the debugger to the running Inventor and i use the old macro afterwards to load and unload the Addin in Inventor like before. At the end i stop the debugger and go further with editing. Until that point everything works fine.

After i have done my changes in the soucre, i need to recompile the Addin to get a new symbol (pdb) file for the further debugging.  But this is not possible because Inventor is still hold handles on the "dll" and the "pdb" file. Only when i quit Inventor i am able to get access to these files again.

But start and quit Inventor is exactly not that what i like to do to start and stop debugging, because that cost me 5 minutes instead of 5 seconds on every small error i find in my source.

 

Is there a effective way to switch between debug and edit mode without loading and unloading the whole Inventor?

 

Many thanks for any suggestions.

 

Norbert Schmitz

0 Likes
1,112 Views
2 Replies
Replies (2)
Message 2 of 3

jeff.pek
Community Manager
Community Manager

Hi Norbert -

 

Unfortunately not really, because of the way that .NET loads add-in assemblies. They cannot be removed from memory. If a change were to be made (not simple) to load the add-ins in a separate AppDomain, then such a thing might be possible, but that's not done today.

 

What you can do is to make sure all other unnecessary add-ins are set to not load at startup; this will help shorten the Inventor restart time.

 

Jeff

0 Likes
Message 3 of 3

Anonymous
Not applicable

I initially missunderstood your post, but now I understand what you mean...

I was too using VB6, but I never discovered your way of unloading/loading the AddIn, so to me the update to .net was solely positive, I can remember having to reregister the dll each time I recompiled, ugly UI... I would not go back for a million (OK, maybe for 10 millions:-))

 

I don't find it anoying to restart Inventor for the things you first call bigger changes and then later call small errors.

I call the changes that require a restart big changes, and of course it would have been nice to just edit whatever without having to restart Inventor, and I axept the restart.

 

Adding public variables/subs/functions or changing signatures are big changes in my opinion, this is not something you do all the time, I hope... private vars/subs/funcs you could add as much as you like (almost)...

 

If your computer needs 5 minutes to start Inventor, you need a new computer!

I got a new computer a few days ago (HP 8740w), so this new one will start up Inventor in one minute (after pressing Run/F5, so there are a few seconds of compile time included) the first time, the next time I try this, it only takes 25 seconds. Windows probably caches Inventor somewhere.

My old computer (4 years old HP nw9440) probably did this in 2-3 minutes the first time, about a minute the next time.

 

One minute... you cant do much in one minute... fill up your coffe mug, update facebook, a cigarette... You would definately not finish you AddIn...

 

I am down to 3-4 restarts a day at most, I can live with that...

 

Sorry if this was just BS, it's kind of late...

 

R

0 Likes