Main Site Documentation

Question on received Exception


#1

Application for Raptor using SD and UsbHost
Microsoft Visual Studio Express 2012 for Desktop - Update 4
Microsoft .NET Micro Framework 4.3
*
My Raptor info:
Loader (TinyBooter) version information:
4.3.3.0 on this computer and device.
Firmware (TinyCLR) version information:
4.3.3.0 on this computer and device.

This is only a general question and not really a problem but I would like to use:

FileInfo fInfo = new FileInfo(“some file name”);

I would like to know why this exception occurs…


//Called on power on/reset if SD Card is inserted
void sdCard_Mounted(SDCard sender, Gadgeteer.StorageDevice device)
{
    FileInfo fInfo = new FileInfo("\\USB\\Application.config");
    bool test = fInfo.Exists;

    if (test == false)
      { return; }
				
 //Also if using 
   if (!fInfo.Exists)
     { return; }

//Try/Catch does not catch any exception
try
{
   if (!fInfo.Exists)
     { return; 	}
}
catch(System.IO.IOException ioe)
{
   Debug.Print(ioe.Message);
   Debug.Print(ioe.InnerException.ToString());
}


Exception System.IO.IOException - CLR_E_INVALID_DRIVER (1)

Message:

Microsoft.SPOT.IO.NativeIO::GetAttributes [IP: 0000]

System.IO.File::Exists [IP: 001a]

System.IO.FileInfo::get_Exists [IP: 0007]

Gadgeteer.Modules.GHIElectronics.SDCard::OnMounted [IP: 0036]

System.Reflection.MethodBase::Invoke [IP: 0000]

Gadgeteer.Program::DoOperation [IP: 001a]

Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054]

Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a]

Microsoft.SPOT.Dispatcher::Run [IP: 0006]

Gadgeteer.Program::Run [IP: 001d]

A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
The thread ‘’ (0x3) has exited with code 0 (0x0).

Only need to know to keep my brain happy…


#2

the fully qualified name of a file on the SD should contain “SD” not “USB”?


#3

@ Mike -

That was so obvious it HURT!

Thank you…

Yes… I should know better


#4

I think the storage device can return the root folder, because especially for USB there might be more than one connected.