Storage card browsing fails

  • Thread starter Thread starter Markus.Humm
  • Start date Start date
M

Markus.Humm

Hello,

at least on the standalone emulator I can't read the files etc. of the
storage card folder with my code. Browsing other folders with the same
code works like a charm.

I get a IOexception there. Unfortunatelly I don't have any storage card
in my real device, so I can't test it right now.

What causes this and how can I change it (CF 1.0)?

My source (beware I'm not using VB.net or C#!):

myFile:FileInfo;
myDir :DirectoryInfo;
fsi :Array of FileSystemInfo;
begin
// use some dummy filename, if other folders like \temp\
// or \Program Files\ are used all works well
myFile:=FileInfo.Create('\Storage Card\grr.txt');
myDir:=myFile.Directory;
fsi:=myDir.GetFileSystemInfos;
end;

Greetings

Markus
 
The exception contains information that's supposed to help you diagnose the
problem. Examine it! Or at least post it here...

Paul T.
 
Paul said:
The exception contains information that's supposed to help you diagnose the
problem. Examine it! Or at least post it here...

Hm, other than the name of that exception it doesn't help much, because
it only says in what module the exception happens, but as developper I
hopefully know where I tapped around.

But I may look at it again and post the full thing, because i've already
catched the exception and only show the message of it which is only
IOException.

Greetings

Markus
 
Examine the exception in the debugger once you have caught it. There's at
least an error code in it...

Paul T.
 
Hello,

the exception message is:

myexe.exe
IOException

Application::Run+0xf
myexe::myexe+0xa

So what else except the IOexception can you read from there?
I'd like to know esp. what +0xf and +0xa means...

Greetings

Markus
 
Paul said:
Examine the exception in the debugger once you have caught it. There's at
least an error code in it...

Okay, if I can get to that code by other means yes, since I'm not using
VB.net or C# I've no debugger (yet) available for CF.

Greetings

Markus
 
Not useful information. The offsets are where the indicated methods are
executing (somewhere in Application::Run and somewhere in myexe::myexe. No
doubt, since you've already said that there's no "\storage card" folder,
you're getting a file-not-found, but you'd have to see what the exception's
HResult member's value is to confirm that.

This is where you pay the price for trying to do something without a
debugger. How much of your time are you going to waste trying to debug
simple things that would take 20 seconds, if you were using a real toolset?

Paul T.
 
Even without a debugger it should provide a stack trace, as the CF supports
that. I think the Details should provide an exception code too. If Delphi
can't provide those readily, don't trap the exception and let it come all
the way out and the CF will throw up a messagebox with the info.
 
The CF has a command-line debugger IIRC. It's been a long time since I used
it (since Studio included it really) but the CF team might have some posted
info on it. You might be able to use it to get what you want. Maybe.
 
Paul said:
Not useful information. The offsets are where the indicated methods are
executing (somewhere in Application::Run and somewhere in myexe::myexe. No
doubt, since you've already said that there's no "\storage card" folder,
you're getting a file-not-found, but you'd have to see what the exception's
HResult member's value is to confirm that.

I didn'r say I've no storage card folder!
My real device has no storage card right now, but the MS emulator has a
Storage Card folder because it's the shared folder!
Is this shared folder treated somehow different than a normal storage
card folder?
This is where you pay the price for trying to do something without a
debugger. How much of your time are you going to waste trying to debug
simple things that would take 20 seconds, if you were using a real toolset?

And what would the debugger have shown here? I know which call raises
that exception. Does it really show more information than the Exception
box that comes up when the exe crashes?

Greetings

Markus
 
The CF has a command-line debugger IIRC. It's been a long time since I used
it (since Studio included it really) but the CF team might have some posted
info on it. You might be able to use it to get what you want. Maybe.
Ah, some usefull hint for searching.
Will look for this later...

Greetings

Markus
 
This is where you pay the price for trying to do something without a
And what would the debugger have shown here? I know which call raises that
exception. Does it really show more information than the Exception box
that comes up when the exe crashes?

The value of HResult...

Paul T.
 
Hello Markus.Humm,

I'm not entirely sure about this, but I *think* that the command line debugger
that works with .NET CF is mdbg, and it's only supported from CF 2.0 SP1.

Regards,
Tomer Gabel (http://www.tomergabel.com)
Monfort Software Engineering Ltd.
 
Tomer said:
Hello Markus.Humm,

I'm not entirely sure about this, but I *think* that the command line
debugger that works with .NET CF is mdbg, and it's only supported from
CF 2.0 SP1.
Hello,

what I've read so far it might also work with earlier CF versions, but
it still requires files from VS2003 or 2005 for connectivity to the
device. So its of no use for me.

Is there any other way to get that HResult value?

Greetings

Markus
 
Hello,

if I catch that exception, can I get the HResult value then via my
application somehow?

Greetings

Markus
 
Yes, certainly. That's what I was expecting you to do, since you don't have
a debugger.

Paul T.
 
Paul said:
Yes, certainly. That's what I was expecting you to do, since you don't have
a debugger.

Ah, ok, will research that later. Thanks anyway.

Greetings

Markus
 
Hello,

I tried to get that HResult code now but without success.
The application simply misbehaves when I try it (grr!) ;-)

Okay this is what I'm doing:

var pfad :String;
myFile:FileInfo;
myDir :DirectoryInfo;
fsi :Array of FileSystemInfo; // alles
begin
Cursor.Current:=Cursors.WaitCursor;
b_ok.Enabled:=false;
b_ok.Text:='0%';
application.DoEvents;
try
pfad:='\Storage Card\'; // this exists as some other place
// of the app. prooves this
// the file grr.txt is only a dummy entry
myFile:=FileInfo.Create(pfad+'grr.txt');
myDir:=myFile.Directory;
fsi:=myDir.GetFileSystemInfos;

// my other processing cut out because the Exception is thrown
// by GetFileSystemInfos

b_ok.Text:='OK';
b_ok.Enabled:=true;
except
On e:exception do
begin
MessageBox.Show('HResult: '+e.HResult.ToString,'Fehler');
MessageBox.Show('Fehler bei Verzeichnisanzeige: '+
e.Message,'Fehler');
end;
end;

Cursor.Current:=Cursors.Default;
end;

If I do it this way I get the WaitCursor but it doesn't vanish nor does
the MessageBox appear. If I remove the first MessageBox.Show I get the
IOException Message shown and if I combine the HResult into the 2nd
MessageBox, I get a "crash" saying: Unsupported Exception.

Very strange.

Greetings

Markus
 
You probably want to catch the exception as an IOException, which is what
you said was being thrown, right? Not every Exception subclass is going to
have an HResult member.

Paul T.
 
Hello,
You probably want to catch the exception as an IOException, which is what
you said was being thrown, right? Not every Exception subclass is going to
have an HResult member.


No, the example stripped down now shows that I catch EVERY exception
regardless of type. The one catched is a IOException but I don't force
it to be or something like this! It's simply the reality.

As shown below (yes you're not familiar with Delphi syntax so I explain
it a bit) I catch the exception e as untyped exception. So it might be
just everything turning up...

Greetings

Markus
 
Back
Top