sameerkapps / SecureStorage

118 stars 32 forks source link

FileNotFoundException #1

Closed InquisitorJax closed 8 years ago

InquisitorJax commented 8 years ago

When accessing CrossSecureStorage.Current from android app, and FileNotFoundException is thrown (seems to be handled internally) Could not find file "Util.SecureStorage"

sameerkapps commented 8 years ago

Yes. That is expected to happen when you run it for the first time as no file exists.

InquisitorJax commented 8 years ago

ah - ok. Is it not maybe possible to do a file exists in code instead of a try catch? A bit unnerving when launching my app and code breaks on exceptions happening.

sameerkapps commented 8 years ago

Sorry about the delayed reply. If the existence of file is checked instead of try-catch, that will be performance hit every time, the app starts. On the other hand, the exception should happen only one time when the application is launched right after install. If it happens again due to some other reason, it is always caught. So app is safeguarded from crash. I understand that it can be unnerving to see the exception when app starts for the first time, but it helps in subsequent runs.

InquisitorJax commented 8 years ago

yeah - I'm not a big fan of using try / catch for logic flow, but I understand your motivation. thanks for the feedback.

Nico04 commented 6 years ago

While I understand the mecanics, is there any way to check that instead of using a try-catch in MY side of the code ?

sameerkapps commented 6 years ago

The NuGet package does not provide any file check. But in the Android implementation of the App, you can check, if "SecureStorageImplementation.StorageFile" file exists.