Check for Apartment state before loading modules

Aug 9, 2010 at 1:53 PM
Hi, I suggest that you check the apartment state before loading any modules. WPK in particular is pretty big, so it's a waste of processing time to load it if the user has to restart PowerShell anyway. Here is code that checks the state: ((get-host).RunSpace).ApartmentState
Coordinator
Aug 10, 2010 at 12:23 AM

You are correct. I will add.

Thanks

Doug

Coordinator
Aug 10, 2010 at 12:59 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Aug 10, 2010 at 1:13 AM

Fixed http://psodata.codeplex.com/SourceControl/diff/file/view/58820?fileId=1558985