I get the following exception: Microsoft.DirectX.Direct3D.InvalidDeviceException on the following line of code in the constructor:

Caps caps = Manager.GetDeviceCaps ( adapterOrdinal, DeviceType.Hardware );

when I connect my laptop to the docking station with an external monitor.  How would I insure that this is going to work under conditions like these?