New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.10 - android app crash - FuseJS/Storage - breaks on a File.Exists call from Uno #129
Comments
Is this bug new in 1.10, or can you also reproduce it on 1.9? |
Yeah, I believe its a new 1.10 bug; I haven't retested in 1.9 but I think I would have noticed it in 1.9, else I wouldn't have been able to get very far with my app :D |
Ok, I did more testing and here are my notes:
FileSystem.exists public Future<bool> Exists(string path)
{
return RunTask<string, bool>(ExistsSync, path);
} Storage.read public static Future<string> ReadAsync(string filename)
{
return Promise<string>.Run(new ReadClosure(filename).Invoke);
} Test app <App>
<JavaScript>
var FileSystem = require("FuseJS/FileSystem");
var Storage = require('FuseJS/Storage');
var filename = "testfile1.tmp";
var path = FileSystem.dataDirectory + "/" + filename;
FileSystem.exists(path)
.then(function(x) {
console.log(x ? "it's there! =)" : "it's missing :/");
}, function(error) {
console.log("Unable to check if file exists");
});
FileSystem.writeTextToFile(path, "hello world")
.then(function() {
return FileSystem.readTextFromFile(path);
})
.then(function(text) {
console.log("The read file content was: " + text);
})
.catch(function(error) {
console.log("Unable to read file due to error:" + error);
});
Storage.read(filename)
.then(function(str) {
console.log("str: " + str);
},function(error){
console.log("Error: " + error);
});
FileSystem.readTextFromFile(FileSystem.dataDirectory + "/" + "testfile2.tmp")
.then(function(contents) {
console.log('contents');
console.log(contents);
}, function(error) {
console.log('error');
console.log(error);
});
</JavaScript>
</App> |
Oh yeah, I retested on 1.9 and it doesn't crash. |
TBH, this sounds a bit like the good old "throwing exceptions inside V8 crashes"-problem. So my guess is that some exception has been introduced... Would it be possible for you to debug this a bit, and try to confirm? If so, it might be possible to at least get an emergency-switch to disable the native stacktrace-stuff, so people can choose what what is broken? :P |
I'm talking about this issue: fuse-open/fuselibs#679 |
Lol, so what happened between 1.9 and 1.10 to cause this crashing(fuse-open/fuselibs#679)? Can't "we" fix that rather? XD Anyhoo, I did do further debugging and can confirm its the throwing of the exception here(or read below): https://github.com/fuse-open/fuselibs/blob/master/Source/Fuse.Storage/ApplicationDir.uno#L52 public static string Read(string filename)
{
string content;
if (TryRead(filename, out content))
return content;
else
throw new Exception("File does not exist.");
} FileSystem.exists doesn't throw an exception when the file doesn't exist, it just returns the result of the File.Exists and thats why it didn't cause a crash: https://github.com/fuse-open/fuselibs/blob/master/Source/Fuse.FileSystem/FileSystemOperations.uno#L75 public bool ExistsSync(string path)
{
// File.Exists also returns true special files like named pipes etc in .NET (mono and MS implementation)
// and also in uBase::Disk->IsFile. This makes the following work for all file system entries:
return File.Exists(path) || Directory.Exists(path);
} |
I have a branch on my fuselibs fork that possibly fixes both this crash and fuse-open/fuselibs#679. https://github.com/mortend/fuselibs/tree/upgrade-v8 My branch isn't ready for merging yet, but can be used to test if a new V8 build fixes the problem(s). |
@mortend cool, I will try it out sometime soon. |
Thanks @mortend it seems have resolved the issue and is working so far, will be doing more testing in the New Year and will keep ya posted. |
This solve the Android crash problems |
I tried the above Source change to mortend's fork but I am still receiving the following crash when launching on android
|
this was the crash log before i switched to mortend's fork
|
This upgrades to a more recent version of V8 on Android. Because the new version of V8 removes some debug functionality, this functionality is also removed from the V8Simple interface. Because we now compile V8Simple and embed V8 static libraries into the app, V8Simple and V8 now use the same standard library as the rest of the app. This seems to fix crashes when getting an exception inside V8 on Android. - fuse-open#679 - fuse-open/uno#129
i switched to the new master now that the upgrade to V8 was merged and my app works, (I didn't have nuget so that may be why it failed last night). Thanks for the hard works guys! |
Closing the issue because it sounds like the Android crashes have been fixed. |
Hi guys,
Storage.read crashes android app (crashing devices: low-end Android 6, low Android 8.1; works on medium-end Android 6).
I've compiled from latest Uno and using latest Fuselibs.
Repeatable test code:
I've narrowed it down to File.Exists causing the crash when using
Storage.read
:https://github.com/fuse-open/fuselibs/blob/master/Source/Fuse.Storage/ApplicationDir.uno#L36
Strangely,
Storage.readSync
seems to be working fine.The text was updated successfully, but these errors were encountered: