Enable Lun causes error

Hey all.

as i can’t use VS to active debug my projects through serial (previous topic of discussion) with FEZ Domino. i have deployed them to my device in usb mode then connected it back up through serial and reset the device. I successfully get debug messages in MF Deploy.

I have inlcuded the code which is running when i get the following error. Appears to occur on EnableLun(0);

does anyone know what i have done wrong? before you ask, yes there is an SD card inserted, and yes it is formatted correctly, and yes i can access its data through code prior to attaching it to the USB client, yes i have got the latest firmware (unless its changed over night). MFDeploy is listening to the Com Port not the USB. The code successfully creates the USB drive (i can see it in windows), however it does not detect anything connected to the USB drive.

SD Created, Lun attached, about to enable lun (the debug message)
#### Exception System.Exception - 0xffffffff (3) ####
#### Message:
#### GHIElectronics.NETMF.USBClient.USBC_MassStorage::EnableLun [IP: 0000] ####
#### FEZ_Domino_Application1.FileSystem::.ctor [IP: 004c] ####
#### FEZ_Domino_Application1.Program::intialise [IP: 0010] ####
#### FEZ_Domino_Application1.Program::button_OnInterrupt [IP: 001c] ####
Uncaught exception

 class FileSystem
    {
        private bool _SD_Loaded;
        public bool SD_Loaded
        {
         get {return _SD_Loaded;} 
            set { _SD_Loaded = value; }
}

        private bool _USB_Reading;
        public bool USB_Reading
        {
            get { return _USB_Reading; }
            set { _USB_Reading = value; }
        }

        USBC_MassStorage USB;

        PersistentStorage sdps; //sd card


        public FileSystem()
        {
            if (PersistentStorage.DetectSDCard())
            {
                sdps = new PersistentStorage("SD");

                sdps.MountFileSystem();

                USB = USBClientController.StandardDevices.StartMassStorage();


                USB.AttachLun(0, sdps, " ", " ");

                Debug.Print("SD Created, Lun attached, about to enable lun");

                USB.EnableLun(0);

                this._SD_Loaded = true;
            }
        }

I worked out my issue.

for those who have a similar one, you need to make sure the persistant storage is not mounted internally before you try to enable it.

(sdps.UnmountFileSystem)