Sdcardexception

When i try to use the sdcard…i get an exception? Using netmf v4.3…any suggestion?

 SDCard sdcard;
  sdcard = new SDCard();

I get this exception…

#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message: 
#### GHI.IO.Storage.SDCard::NativeConstructor [IP: 0000] ####
#### GHI.IO.Storage.SDCard::.ctor [IP: 0029] ####
#### GHI.IO.Storage.SDCard::.ctor [IP: 0005] ####
#### ZigmateGadgeteer.Program::ProgramStarted [IP: 05a3] ####
#### ZigmateGadgeteer.Program::Main [IP: 0015] ####

A first chance exception of type ‘System.InvalidOperationException’ occurred in GHI.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in GHI.Hardware.dll

Are you sure that SD card is present and properly formatted?

@ andre.m - not sure what you mean? I am using the Fez Cobra II by the way.

I will also check if SDCARds are formatted, bit i would have thought it would allow me to initialize the sdcard before even if the sdcard is formatted incorrectly.

I use the following with pure netmf to create and use the SD card on a G120 or G400 system.


sdcard = new SDCard(SDCard.SDInterface.MCI);

Maybe try to pass in the type as I have done and see if this works? In saying that, with no parameter it should default to creating the MCI type.

That exception is usually because bad connection or bad card. Try to different card, format by PC, eject - reinsert again…