A problem repeatedly occurred when reopening PWA in iOS/Safari - reactjs

I'm developing a PWA (VueJS/Quasar) and, from time to time, face the following error when re-opening the app (saved on the home screen) after a while.
Black screen with: A problem repeatedly occurred on "https://..."
I have found some hints (memory/performance, css issues) and related questions (e.g. iOS safari crashing (a problem repeatedly occured)) but I have not fully understood how to trace down that problem.
Does anyone have a clear idea on how to tackle it? As said, it only happens once in a while.
While preventing the error in the first place is a priority, is there anything I can do to e.g. reload the app once this error occurs or is this fully out of my control as the app has crashed anyway?

Related

What command or procedure to use for vscode to display in the terminal, the line of code responsible for displaying a blank page in reactjs?

I'm working on a web project with reactjs. For some time, whenever I run my code on vscode, the browser shows me a nice blank page. I don't know why because it didn't happen before and I didn't make any changes to the source code. I read an article on the web that said it was due to an error that occurred in my code. But despite that, I don't understand because even before this blank page problem, I often had errors in my code and react showed me on the web page instead of the application a black page with the details and the lines errors occurred. But now nothing, just a blank page and in the command line, no errors are reported to me, just warnings.After reading an article on the internet, I realized that I could use error bounds on components to prevent this, but since for some reason
efficiency I couldn't use error limits on all my components, so I had to use it on the element responsible for the crash. But the problem is that I don't know which element is responsible for this and vscode doesn't show me information about the crash. Still, according to the official documentation, vscode should give details of my page crash as well as the location of the error and I'm using a react version greater than 16. I don't know what to do or what resource to use. So I ask for your help. Thanks!

RESULT_CODE_INVALID_CMDLINE_URL when running a react app

I had a react app that was working fine before my computer was force shut. I am using npm start to serve my app in a local server. When I reopen my computer and start my server the first page( the "/" url) works fine, but when I push a new url to the history( props.history.push("/pages")), the browser freezes and it give me this error . This was in chromium and I even tried it with other browsers like firefox but the browser just freezes. Assuming the problem might be with my computer I have also tried other devices on the network and the same problem keeps happening. I have even cleared the npm cache by npm cache clean --force. But nothing solves the problem and it is frustruting to debug since nothing is printed on the dev tools and no error message is throwen by react. If some one has come accross such a problem would like to hear a suggestion.
This had happened to me a couple of times. This seems to keep happening in chrome browser when you have an array and you are pushing too many items to it (it is like
stackoverflow:)
). You may want to edit your question so that more people can benefit from these, it isn't actually a react problem. It is a limitation in browsers I guess. They should at least warn you about what the error is. so for anyone who wants to regenerate this problem use the following code in the chromium console or run any js script on your chromium browser.
let arr = [];
let arrcounter = 13;
for (let x = 1; x <= arrcounter; x) {
arr.push(x);
}
This is an infinite loop as x isn't being incremented, which means an infinite amount of 1's are pushed to the array which causes the above error. This atleast was in my case. There might be other reasons for this problem to be caused, but check for such a mistakes in your code because neither your browser (which is a bammer) nor your editor notify you about such mistake. If this solves your mistake let me know.
As to how to debug your code.
You can start by commenting out all your code except the necessary react requirements then uncommenting each part in a controlled way to see which part of your code is causing the problem.

No theme.css file found Codename One

While I was coding my computer crashed, when I got back to my project and run the Simulator I got this message in console: No theme.css file found. CSSWatcher canceled What does that mean? Is it something critical, how to fix that?
No it's not important at all. It's a new feature that we will announce soon, it's just a message that indicates it isn't active. I've removed it since it's irrelevant.

android.hardware.camera2 ERROR CAMERA IN USE

I'm using the google sample 'android-Camera2Video':
https://github.com/googlesamples/android-Camera2Video
The problem is that when the app is finishing the recording, sometimes it stucks for a moment, and then calls the onError() handler of the CameraDevice.StateCallback with 1 - 'ERROR_CAMERA_IN_USE' error code.
It does not happen every single time, it happens in about 90% of cases, and sometimes everything works fine with no errors. I couldn't find out on what it depends and how to resolve this issue. If anyone have met this problem before, please help.

WPF window crashes on startup, or it starts but hangs and does not render contents

I've had a couple nasty problems with WPF applications crashing on certain client machines but working everywhere else - every developer's nightmare.
I'm posting the problems / solution here to help preserve the sanity of fellow developers. These were not easy to troubleshoot.
Both of these issues are classic "it works on my machine but not theirs" issues.
WPF app crashes on startup. No errors, no idea why.
WPF app starts up, the window border shows, but the contents do not paint. It just hangs (reported as a "transparent window") Clicking to close triggers a crash report (machine was windows XP).
1) WPF app crashes on startup. No errors, no idea why.
The key troubleshooting step to actually find the error in the first place is to add additional error handling to app.xaml.
In your App.xaml header, add:
<Application DispatcherUnhandledException="App_DispatcherUnhandledException" />
and in your App.xaml.cs, add something like:
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs args)
{
log.Fatal("An unexpected application exception occurred", args.Exception);
MessageBox.Show("An unexpected exception has occurred. Shutting down the application. Please check the log file for more details.");
// Prevent default unhandled exception processing
args.Handled = true;
Environment.Exit(0);
}
After adding this additional debugging, I caught the error:
System.TypeInitializationException: The type initializer for 'System.Windows.Media.FontFamily' threw an exception. ---> System.ArgumentException: Illegal characters in path.
Further research, googling, and coffee, led to the solution that the client machine had a trailing '◻' character in a font entry in the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
Removing this rogue character solved the problem.
See the career-saving blog post "How to Crash every WPF application".
2) WPF app starts up, the window border shows, but the contents do not paint. It just hangs (reported as a "transparent window")
This was another font-related issue. I initially boiled this down to a fontSize="16" in Window.xaml not working on one (and only one) machine at a client site, as if WPF refused to render their fonts at size 16 (?). I removed the code specifying the font size and it worked ... but as it turns out, it only worked for my login profile. It continued to fail for a colleague's login profile on the same machine machine. I could literally login as myself, run it successfully, log out, he'd log in as himself, run it, and it'd fail with the "transparent hanging window". Same machine, same permissions.
As a last resort, I logged in as him and noticed he had a custom theme set with enlarged font. I changed the windows theme back to the classic theme ... and this fixed the issue (?!?). This issue appears to also be font related, but I don't have an absolute root cause identified. Changing the theme back to standard theme is a temporary workaround.

Resources