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

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.

Related

Saving state when closing android app on chromeos

Our android app saves state before it is killed via (Activity::OnSaveInstanceState).
The works well if the app is back grounded before being killed. (which one has to do before explicitly closing an app android)
However on ChromeOS, android apps can be killed without back grounding them.
Apps have an 'x' in the top right corner, which closes the app without back grounding it.
If the app is ended this way, OnSaveInstanceState doesn't appear to run (or perhaps it doesn't have enough time to finish?), and so the app state isn't saved.
Q: Is there away to either:
Disable/hide this 'x' for the android app?
Save state even if the app is ended this way.
Note: android apps on chrome also have 'back arrow' (not shown in this screen shot - top left on the toolbar), which closes the app. State is saved as expected, when app is closed that way.
Don't save state in Activity::OnSaveInstanceState use Activity::OnPause instead.
After setting up debugging from Visual Studio for the ChromeBook, I confirmed that Activity::OnSaveInstanceState is not being called, when clicking on the 'x', (like it is when one backgrounds an android app, then explicitly close it
However Activity::OnPause and Activity::OnDestroy are called.
Despite its name and contrary to lots of advice, it seems that it's not safe to save state in Activity::OnSaveInstanceState
Moved state saving to Activity::OnPause works for me.

Trigger "application quit unexpectedly" popup when OS X deamon crashes

I'm working on a new OS-X Daemon process (run from launchd) and would like to get popup window every time it crashes with all relevant information (pid, path to crash file, etc...). This will sure help my debugging effort in this early stage of the development.
Basically, i want to have the same behavior as a UI application. For example :
I've made some research and found out about the CrashReporter, but i don't know how to register my app to this service. But it seem like there's no way to trigger popup windows from this service, since crashes are system level events and apps have zero interaction with those.
Maybe there's a way to do so by setting up some parameters in app bundle or via Info.plist ?
EDIT: looking at the crash report manual, it looks like the unexpected dialog works only on GUI user mode, and not on daemon that runs from launchd. perhaps i'm missing something ?
In addition, if the program that crashed is running as a logged in GUI user, CrashReporter will present the user with a dialog asking them whether they want to submit a bug report to Apple (see Figure 1). If the user clicks the Report button, CrashReporter displays another dialog that shows the details of the report (see Figure 2) and allows them to comment it before submission.
I've read that Developer option enable in addition to application crashes, crashes are also displayed for background and system processes. but unfortunately i doesn't work for me.
thanks
Seems like the problem occurs since my background process runs under root privilege, and root privilage process (not just daemons) cannot initiate any UI widget on the screen.
I guess that the only way to deal with it, is by catching the signal that trigger the crash, and send details for a proxy process that run on non-root mode and can initiate the UI dialog box with crash details.
I would be happy to hear for better proposals.
Since CrashReporterPrefs, which allowed you to enable this behavior for daemons, no longer comes with developer tools, you can change the behavior to show the dialog for daemons by running this command in the Terminal:
defaults write com.apple.CrashReporter DialogType Developer

VS2013 won't debug a specific web application

I have a web application that uses IIS, but when I try to debug it VS just locks up and gives me the hour glass cursor icon. No browser window opens, nor does an instance pop up in the Task Manager. VS says its Running / not "Not Responding", but I cannot interact with the IDE. Can't Ctrl-Break to stop or anything.
I was able to run it before, and I'm not aware of any system or IIS changes that could cause this. I've disabled source control and I've tried launching the app in both Chrome and IE but it still behaves the exact same way as described above.
Has anyone else encountered this? The only threads I could find just describe general slowness in the IDE but otherwise its functional. The recommended fix was to disable the source control functionality, which as I said I already tried.
I should note that I don't seem to have an issue running & debugging winforms applications. I also just created a web application and was able to launch it in Chrome and get to the homepage. Also, it doesn't make a difference if I have a breakpoint set or not.
This solution has 4 different projects. If I set a different project as the Startup Project, it does run and launches the browser but it just gives me a 'file explorer' sort of view where it just lists the files in that project's directly which is obviously not what I want.
Edit; If I manually open a browser tab, try to navigate to http://localhost/myApplication, VS pops up and asks if I want to attach process w3wp.exe to IIS APPPOOL\myAppPool. If I attach, it opens a new tab in Chrome and my application runs. But unless I do these 2 steps, it does not run.

Windows Phone XNA Games Hangs on Resume when Guide is Visible on WP7.x

My Windows Phone XNA game calls Guide.BeginShowKeyboardInput to get the user's name. While the Guide's input screen is shown, if the user presses the Home or Search (hardware) buttons, the game is deactivated as usual - but if the user then presses the Back (hardware) button, the game should resume but it doesn't. Instead it shows the "Resuming..." message until Windows Phone gives up trying to resume the game and kills the process.
Please note:
My app is failing Microsoft certification because of this problem - I really need to fix it!
This only happens in my game when the Guide input screen is shown - when it's not shown, the game
resumes properly after being deactivated.
This problem only occurs when the game is run on WP7.x (verified problem on WP7.5 and
WP7.8) - although the game seems to resume properly on WP8 devices.
I've created a blank XNA game project, called Guide.BeginShowKeyboardInput and tested it using WP7.x devices, and this problem-behavior doesn't occur.
I've tested the game without enabling Music & my Trial License manager (they use timers) and it still does this.
Exact same behavior occurs in the emulator (resume-failure on WP7.x emulators, works fine on WP8
emulator)
I used threads to asynchronously download content during the loading screen - but they already completed and exited.
I don't believe other threads are running, although this seems like
it could be a thread-blocking issue.
Any other ideas on what could be blocking the game from resuming when the Guide.IsVisible or how to debug/resolve this problem?
The solution to this issue was simply to NOT use SuppressDraw when dealing with any operation that passes control outside of the app, e.g. Launchers, Choosers and the Guide.
Have you tried calling "Guide.EndShowKeyboardInput" in either the Deactivating or closing events?
So that the guide is closed before the app suspends, you do get 10 seconds to suspend so this might be worth looking into.
If you want the guide to re-show on resume, then in your state saving code just have a flag and open the guide if it's set.

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.

Resources