How do I step through Cordova code when the app starts? - debugging

When I debug a Cordova app what I constantly do is step through its code inside Chrome's WebInspector. In order to be able to do this, however, I have to wait for the device to become ready in chrome://inspect/#devices (only then can I click on the appearing link for the started app). But if I do this the inspector will not halt on breakpoints if I am not quick enough. How do experienced Cordova developer tackle this issue?

Additionally to frank's comment I just found GapDebug which offers instant debug and, thus, comes close to what I deserve.

Related

React native debugger is too slow

Ok so this is really been a headache for me. I have been trying to develop a react native app but the Debug JS feature on chrome makes it run very very slowly. Each button click and transition takes almost a couple of minutes and sometimes longer making debugging close to impossible.
I have removed many of the unused console.log statements to try and speed things up. I have also pulled the debugging tab into its own separate window. But there no real change in speed. I have also tried to connect the phone over wifi to debug it. I am running the code on the hardware device and have already tried the suggestions given in the following posts
https://github.com/facebook/react-native/issues/10559
https://github.com/facebook/react-native/issues/5632
What is the best approach to make the debugging faster and more tolerable?
Check the clocks on your phone and your computer.
In my case, the lagging occurs when the phone's clock is behind the computer's clock for more than a second. The issue resolved when I changed the phone's clock to a few seconds ahead of the computer.
My solution was to turn off the react "React Developer Tools" extension for Chrome. Really made a big difference. Note: I use the "React Native Debugger".
Have you tried to deactivate the "Slow animation" option in the debug menu of the simulator?
I had the same issue and that did the trick when running my app in the ios simulator.
Try to disable "Dev Settings" -> "JS Dev Mode" -> Reload.
Hope it helps.
Unchecking Slow Animations in Debug option of Simulator does the trick! Very simple.
try to comment all console.log things on your project, then check the running speed. the remote debugging is load on your browser (chrome v8) and because of that the app loading is not gonna be to slow.
Using the debugger in Opera helped me quite a bit with performance in Debug mode. I also noticed that profiling temporarily fixes the performance in Chrome's devtools.
In React Native Debugger, right click -> just select 'Toggle React DevTools' and close react dev tools window
In my case, the lagging occurs when the phone's time is behind the
computer's time. when I
changed the phone's clock to a few seconds pr few minutes ahead of the computer.
It's really working super fast now.
Remove bundle location
Install the app again.
npx react-native run-android
or
yarn react-native start andoird
Open React native debugger
Open the dev Menu and select debugging

My windows phone application runs when ran though visual studio (onclick of device button) but when I disconnect and run it doesn't?

I have written file picker code in my project. When i run the project in my windows phone by clicking on device button in visual studio, the app runs fine(I mean it opens pictures library and i can select a photo and preview it).
But when I disconnect my usb and then open the app in the phone and when i open pictures library on click of a button , the pictures library opens briefly and then the app crashes immediately(My app closes).
Can anyone please help me with this??
As written in the blog post , the AndContinue method run in a different process and to do so, the current running app goes into the background or even gets closed sometimes, that is what you are experiencing in your app as far i can tell but not sure why different things happening during debug & deploy.
There must be a callback inside app.xaml.cs specifically to handle the condition when calling application(which was sent into background) comes in foreground, read this blog post carefully & you'll understand as what you need to change in your code :
using-the-andcontinue-methods-in-windows-phone
http://blogs.msdn.com/b/wsdevsol/archive/2014/05/08/using-the-andcontinue-methods-in-windows-phone-silverlight-8-1-apps.aspx
I just dealt with this issue and one of the reasons why there are differences between debug and deploy is because of the suspending event.
During debug, the application does not actually get suspended until you manually do it through Lifecycle Events. This means that when you pick a file on debug and the app is put to the background to load the file picker, it is not actually suspended, while when the app is deployed, it actually gets suspended.
Look into your app_resuming method and OnSuspending methods in your app.xaml that may be causing errors not occurring during debug.

xamarin studio stops debugging

I'm using xamarin studio and monotouch for developing iphone applications. When I set break points on my code and start debugging with the xamarin studio, the debugger breaks the codes on the break point correctly, but the problem is that when I trace the codes with debugger after some seconds ( maybe 30-40 sec) the debugger stops debugging, just like a crash. What should I do?
EDIT
I noticed that it is not because of the break point. Whenever I do not work with the phone after a few seconds the debugger disconnect and stop debugging. Is this really a bug? I think maybe there is a setting that if I change it then the issue will be fix.
Isn't this done by the iOS operating system??? doesn't it only give you ~30 seconds to return from the first event otherwise it kills the application process ? So if you sit in the debugger then it will kill that too?
If it's a bug, verify if there is a newer release and update you copy.
Otherwise, report it to the software providers for a solution.

WP7 app won't launch from app list

I have a simple Windows Phone 7 application which is working perfectly when started from Visual Studio. However, if I deactivate the app (press Windows button or back button from the application's MainPage) and then click the app's icon to relaunch, the screen will flash and return to the list/home screen. I assumed this was an issue with the emulator but when I got a developer device I have the same issue.
Note that reactivating without a complete tombstone works (pressing Windows button from the app and then back).
I have no idea what causes this or how to proceed with debugging. Hopefully someone else has experienced this and knows a fix.
Turns out there is a bug, i found the solution here http://forums.create.msdn.com/forums/p/67522/416995.aspx
In short, it turns out that the Microsoft.Xna.Framework.Media.MediaLibrary class (which I am using to display pictures on applications main page) is not properly initialized when the user has not opened a media hub prior to you calling it. So picture collection properties are null or empty. The solution is to add a call to MediaPlayer.Queue.ToString(), it will force the initialization of the native media library allowing you to invoke the MediaLibrary later on.
Sounds like an unhandled error on startup is causing the app to crash.
Trap/log/handle/display any unhandled exceptions. Also check what you're doing on startup.
IF you are saving something (to Isolated Storage) after first run and then opening it on subsequent launches then that's where I'd look first.
If it works when launched from Visual Studio then this will probably be due to the way you are rebuilding/redeploying the app before launching it in that case.

Configure Visual Studio to break when any managed code is hit

I am spinning up an ASP.NET website from Visual Studio for debugging purposes. I am unsure of the entry point for a given action, so I would like VS to break as soon as any managed code it hit (thus showing me the entry point!). How can I do this?
You can try to launch the app using F10 rather than F5. This will show you the starting point of the web app bootstrapping process. Another thing you can do is to let the app start as usual (F5) and then detach from the browser and pause the app before clicking anything in the browser.
Unfortunately it will stop deeply in the ASP plumbing code. To get to the app code will still take some digging
You can place breaking points on selected patrs of your code

Resources