SD card examples

In the GHI SD card module documentation:

Example 3, uses a .netmf based solution to mount, read, and write some string data to the SD.

Using this example with a Spider module, I end up with a exception thrown right at the first line.

    pStore = new PersistentStorage("SD");

Unhandled exception of type ‘System.InvalidOperationException’ has occurred in GHI.Premium.IO.dll.

Suggestions? I tested Example 1 successfully. There is a formatted 2gb card in the slot.

from the top of Program.cs

using System;
using System.IO;
using System.Text;
using System.Threading;
using Gadgeteer.Modules.GHIElectronics;
using GHI.Premium.IO;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Presentation.Controls;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

        PersistentStorage pStore;
        VolumeInfo pStoreI;
        void ProgramStarted()
            // Attempt to mount the FS and get info
            pStore = new PersistentStorage("SD");  // crash!

@ Familyghost - I just encountered this same problem after reformatting an SD card on Windows 8. The default Allocation Unit was 32 kilobytes. After I changed it to 4096 bytes, it worked.

@ jasdev - Thanks. I tried reformatting the card to FAT32 with 4096, but it did not affect the behavior. I went back to normal FAT format with default allocation selected.

I was able to validate the SD card will mount, read and write, using a different Gadgeteer test program that relied on this method:

this.sdCard = new GTM.GHIElectronics.SDCard(5);

So the hardware is working.

But example #3 uses the GHI.Premium.IO Persistent Storage class.
And it crashes right on the first line where it creates the field.

private PersistentStorage pStore;
#### Message: 
#### GHI.Premium.IO.PersistentStorage::.ctor [IP: 0000] ####
#### GadgeteerApp4.Program::ProgramStarted [IP: 0008] ####
#### GadgeteerApp4.Program::Main [IP: 0015] ####

A first chance exception of type ‘System.Exception’ occurred in GHI.Premium.IO.dll

@ Familyghost - I’m also using premium GHI (NETMF 4.1), and it crashed in that same place until I reformatted the drive with 4096 byte allocation units. Sorry, but I don’t know what else to suggest.

@ Familyghost - What class and brand is the SD card you used?