File.WriteAllBytes "System.IO.IOException"

@ PintSize.Me - Whats the error?

The same one I’ve been getting.

An unhandled exception of type ‘System.IO.IOException’ occurred in System.IO.dll

@ PintSize.Me - on which line?

stream = File.Create(fileName);

File name evaluates to \SD\DeviceID.cfg

What firmware version on the bee?

4.2, just downloaded it yesterday. The Cerbuino page says you have to use 4.2 for the CerbuinoBee.

ClrInfo.targetFrameworkVersion: 4.2.0.0
SolutionReleaseInfo.solutionVersion: 4.2.3.0
SolutionReleaseInfo.solutionVendorInfo: Copyright © GHI Electronics, LLC
SoftwareVersion.BuildDate: Aug 22 2012

This might be a daft question but have you tried creating a file on the card under windows to make sure its not read only?

I actually deleted all the files on the cards right before sticking them into the Bee, so not read-only.

@ PintSize.Me - Can you put try catch block around the code and and check hresult value of the caught exception. You can put Debug.Print inside catch section and set breakpoint on that line. This will let you to examine the excpetion object.

Or you can use my wrapper

http://www.tinyclr.com/codeshare/entry/218

I am trying to understand what is the actual error is. IO Exception is too generic.

1 Like

I was reading a post about cards turning read only, humor me and create a txt file on one.

I actually just did that, I created a file with the name I am looking for and it is still returning false on Exists.

I am going to try Architect’s suggestion to catch the hresult.

HResultToString returns CLR_E_INVALID_DRIVER

I was afraid of that. That error is returned from all kinds of places in PK.

GHI to the rescue?

Now where did I put that phone number for the GHI ambulance?

There was another update. It is now 4.2.3.1. Try that one.

http://www.tinyclr.com/forum/topic?id=8498

Updated to 4.2.3.1 and still have the same hresult.

ClrInfo.targetFrameworkVersion: 4.2.0.0
SolutionReleaseInfo.solutionVersion: 4.2.3.1

What is weird is that Justin has it working on his Bee, but you can’t. Hopefully it will work on the new sd cards that you are getting soon.

Ok, so it turns out to have been an issue with the file name. It needs to be SINGLE backslashes, no double.

\SD\DeviceID.cfg is valid
\SD\DeviceID.cfg is invalid and returns the driver error

I am glad summer is over!

@ PintSize.Me - Good news :slight_smile: - that’s why Path.Combine is useful with getting rid of “\”'s