08-26-2009 10:15 AM
Is there any way to fully unload all modules after a sequence has executed? I am trying to debug a .NET module using Visual Studio 2008. I attach it to the sequence editor process and I am able to do all the stepping in and setting breakpoints that I want. However, if I need to change my .NET module and recompile it, I can't do that without completely exiting the sequence editor. This is a big pain because the sequence editor doesn't exactly shutdown or startup any too fast.
Am I missing something? This really makes development difficult.
Solved! Go to Solution.
08-27-2009 09:44 AM
Skeptical,
Have you tried choosing File» Unload all Modules? In the NI TestStand Customer Education course (both regional and online) we teach you that this is the way to have TestStand force an unload of any code module from memory for further editing, whether it was created in .NET, LabVIEW, etc.
08-27-2009 09:50 AM
Hi,
You can also unload all modules programatically for example by using an ActiveX call like I do in the sequence below.
( I put this in cleanup for long sequences )
You probably can call this from TestStand API using a .NET adapter, and the appropriate dll that enables you to mess around with TestStand API.
Hope this helps,
Maciej
08-27-2009 10:43 AM - edited 08-27-2009 10:46 AM
Skeptical -
Before you do Unload All Modules, you wil also need to detach the Visual Studio debugger from the TestStand.
There is a catch here:
To avoid this catch, when you attach the Visual Studio debugger to the TestStand process, configure it to debug only Managed code. In Visual Studio 2008:
Then, before you rebuild your .NET code module, in TestStand you Unload All Modules and in Visual Studio you Debug>>Detach All.
To make the attach process a little more convenient, you can probably create a Visual Studio macro to attach in this manner (so you don't have to go through the menu and dialog boxes each time) and create a command button to run that macro.
To elaborate on Maciej's repsonse, I'd also like to point out that with TestStand 4.0 and later, you can use API in expressions (RunState.Engine.UnloadAllModules()) to unload all modules (instead of using the ActiveX adapter).
David Rohacek
National Instruments
08-27-2009 10:54 AM
Thanks to David and Maciej for your input.
For the sake of completeness I want to point out as well that TestStand 4.2 supports native Visual Studio 2008 debugging, which makes this process a lot simpler. I gather from your previous posts that you're using TestStand 4.1.1, so this may be a consideration for you.
08-27-2009 01:25 PM
Thank you all for your help. I think I have it working (cross my fingers).
The key for me seems to be doing the Unload All Modules in the sequence editor before detaching the process in Visual Studio.
For what it's worth, I don't see the Debug>>Detach All menu item in either VS2005 Pro or VS2008 Pro. I can do Debug>>Windows>>Processes and select the process to detach. I guess I'll have to call Microsoft on that.
Thanks again.
08-28-2009 02:30 AM
Just regarding VS,
You will see the Detach All option only after you have attached your VS code to a given process.
It doesn't become visible until your debugger is attached to a running process.
I'm assuming you just opened a project clicked on Debug and could not find it there, but you were not actually debugging an attached process.
I have VS 2008 and it shows for me.
Cheers,
Maciej