What could be causing my WP7 app to crash on only some models? - silverlight

I've been working on this problem on and off for about a month. I don't expect anybody to be able to give me a definitive answer. I'm just completely out of ideas at this point and could use anything.
The problem is that my app crashes on only some models of phones. I have an HTC surround and it runs fine. It has also been tested on a Samsung Focus and it works there to. It crashes pretty consistently on a HTC mozart. There are other phones it crashes on but I don't know what models they are. I don't have access to an HTC mozart so debugging has been very difficult.
I'm handling the application UnhandledException event and I have try catch around every background thread. The error handling code never runs.
What I know:
Sometimes it freezes and requires a press of the power button. At least once it required the battery taken out. Most of the time it freezes and then crashes.
Most of the time it crashes on the main menu, before everything displays.
It's not 100% consistent. Sometimes it works for a little bit, but never very long.
It's not because it's out of memory. Most of the time it crashes while using less then 8MB.
When all the exception handling didn't work I added debug logging. This slows things way down but at the same time the issue goes away.
These symptoms make it sound like a deadlock to me. Although I have gone over the code and there is no thread ever entering more then 1 lock at a time.
Any ideas on how I should track this down would be appreciated.
Edit: This is a WP7 version of my game. I've just been able to confirm with a volunteer with an HTC mozart that the simplest conversion of the code meant for to run on the web will crash on the phone. That's code has no networking, isolated storage, or sound.
I also should have mentioned that this has passed certification and was in the marketplace for a few days until I took it down because it got bad reviews (because it was unplayable for some people)

If the devices are locking up, then my suspicions would be to look at the areas where you are closest to the driver level/hardware, which (looking at your game) are:
the display
the sound
It could also be just about due to processing/CPU activity - but generally "User level" code shouldn't be able to lock up your phone - that functionality is reserved for kernel software.
The only way of really testing this is to get hold of a device where this "reliably crashes" (e.g. a Mozart) and to go through the process of disabling bits of functionality one by one.
If this is a Silverlight app, then I'd expect Microsoft to want to help - I'd contact them via AppHub and via their local Evangelist team - they'll have the means and the motivation to assist you.
I'm happy to assist on testing on a developer-unlocked HTC Trophy if that helps!

The only thing I can think of that's unique to the Mozart is that it has an 8MP camera and all others have a 5MP camera.
Are you using a CameraCaptureTask and expecting the returned image to be a certain size?
Other than that, what does the app do? what services and device functionality are you using?
Do you have any network access running on a background thread?

I had roughly the same problem when developing my WP7 app. As far as I can tell it isn't as much model bound as it is device bound. In fact I had my app deployed to 15+ Trophy's (my company gave all their employees one of those) and it would repeatedly crash on some of them all having the same firmware. Some of the feedback I got through the reviews seems to indicate that it also happens in the wild.
In my case the crash occurs primarily (only?) when the app is launched. There does seem to be a strong correlation between internet connectivity and crashing in that I can 'recreate' the crash by putting my phone in flight mode, unplugging the network cable from my computer and then deploying the app. In that case too it immediately crashes and no event or break point is ever raised.
My gut feeling tell me it might have something to do with the map control as that does tend to respond funky to poor connectivity when the application is loading (like displaying an error message that the card cant be loaded while simultaneously displaying the map)
Does your app also use the Map Control (in combination with a Pivot control perhaps?)

Some of the devices have issues where you need set things to "content" instead of "embedded resource" in your project.
Although i've more heard about that issue related to app startup time, as on some devices (HD7?) the load of the app was taking enough time that the app was never allowed to start, the OS thought it was taking too long and killed it.

Related

How to send waypoints programmatically to drone?

I am very new at this and trying to get an understanding of this. I have read a lot on the DroneKit-Python site trying to figure out how exactly am I able to communicate with it.
Drone I am currently using is Iris+
I have looked more and there are software that already provide this, but I want to be able to control it plus more.
I want to set waypoints, tell it to then fly give the way points and keep going to them. Also, to be able to arm itself, which is in the example, and override the safety mechanism.
Here is the basic of what I am trying to use it for. Have it fly up at a certain time. Go to the waypoints 1,2,3,1,etc.. Then after X amount of time or on low battery go back to launch point and land.
I have found plenty of code that provides what i need to do, though I don't know if it will work and more importantly I don't even know how to start programming for this. Maybe I have the wrong approach in doing this?
I kind of want this to be a light API, so that in the future I can make a simple UI on my phone and insert some coordinates to give it ways points and that is it. I know there is software out there already that does it, but I want to remove the need for touching the drone. I want it to start and end autonomously.
If anyone could help provide some info that much would be greatly appreciated.
Assuming you have no companion computer (Iris+ does not by default), you are OK with running a ground station app (you won't be out of range to send commands to "end mission on time expiry") and that driving the behaviour from your phone is important, I would be looking at DroneKit Android.
Some notes:
You're going to have to touch the drone at some point to attach the
batteries.
You can arm the device from dronekit
You can override the safety mechanism from a script. I hope you have
a lot of money to pay for the new drones you're going to have to buy when they crash and all the litigation from damaged people and property (in other words "don't do it".
The default behaviour is to return the device to launch (RTL) on low battery. This is convigurable
Setting a time is more "problematic". You can have a timer in a script that then sends return-to-launch but the script needs to be connected to the UAV. This means that either you have to be running in a connected ground station (which might potentially be out of range) or on a companion computer.
Iris+ does not have a companion computer. You have to install one or connect from a Ground Control Station.
DroneKit-Python runs on Linux, MacOSX or Windows. You can't just run it on an ordinary phone, though you could find some other mechanism to send messages/scripts to it running on a companion Computer.
DroneKit Android runs on Android. We do have a planned iOS version too. In theory these could run on a companion computer, but in practice currently these are only used as ground stations.

Is it a good idea to use a Screensaver on a raspberry pi as digital signage?

I asked this question in the Raspberry PI section, so please forgive me for posting this here again. Its just there doesn't seem to be as active as this section of the forum. So, onto my question...
I have an idea and I'm working on it right now. I just wanted to see what the community's thought was on using a screensaver as digital signage. Every tutorial I've read shows someone using chromium in kiosk mode, and while that's fine and works well for some uses, it doesn't work for what I need. I have successfully completed a chromium kiosk, and it was cool. But the signage that I need to create now, has to work without internet. I've thought about installing LAMP locally on the PI, and still using chromium. I still may have to if this idea doesn't pan out. All I need from the signage is a Title Message in the top center, and a message body underneath it, with roughly 300-400 character limit. My idea is to write a screensaver module, in C, that will work with a screensaver such as xscreensaver. The module would need to be able to load messages from a directory on the pi. Then for my clients to update their signage text, I would write a simple client that sent commands as well as the text via SSH to the pi. I want to know what other people think about this. Is it a good idea? Bad idea? Should I "waste" my time doing something like this?
Thanks in advance.
I am already using a rPi as digital signage, just over a year. I am using two different setups:
version 1 uses Raspian loading xdesktop and qiv image viewer to cycle images stored on the Pi itself, synchronized with a remote server. The problem I found was power and SD stability, when the power fails, which it will do no matter what, just when... The Sd card can become corrupt due to all the writing that Raspian does all the time. Certainly does not really need to write to SD.
version 2 uses a RO-filesystem and a command line image tool. Uses the same process to show images from local, and sync with server. But power fail causes no ill effects.
I am not using screensaver to display images, that seemed redundant to me, and unnecessary to wait for the SS to start just to display the images.
Some of the images are created using imagemagik, which is nicely dynamic where needed.

Avoiding all system messages and messages from other software

Here is the situation. The company I work for builds this piece of software in c that can make a Windows computer act a bit like a TV. Essentially, our piece of software is meant to be played full screen and content is displayed from the internet without the user having to ever touch the computer again.
The problem is that once in a while, the system brings up pop-ups like "Your Windows system is ready for an upgrade." or "Please renew your Norton subscription" etc. which the user has to periodically and manually remove.
Is there a way to display content full screen without being bothered by those warnings?
Yah, whether or not the development community agrees, Microsoft has several standards for when and why it might be acceptable to have exclusive use of the monitor.
The most official strategy is to use DirectX in exclusive mode. This is what games do, what windows media player does in full screen video with hardware acceleration enabled, etc... If your application is multimedia intensive (as suggested by TV like functionality), you should probably be using DirectX too. Besides giving you the exclusive display access it will also increase your applications performance while lowering the CPU load (as it will overload graphics work to the video card when possible).
If DirectX is not an option, there are a great number of hacks available that seem to all behave differently between various generations of windows operating systems. So you might have to be prepared to implement several techniques to cover each OS you plan to support.
One technique is to set your application as the currently running screensaver. A screensaver if really just an EXE renamed to SCR with certain command line switches it should support. But you can write your own application to be such a screensaver and a little launcher stub that sets it as the screensaver and launches it. Upon exit the application should return the original screensaver settings (perhaps the launcher waits for the process to exit so that it returns the settings in both graceful exits and any unplanned process terminations ie: app crash). I'm not sure if this behavior is consistent across platforms though, you'll have to test it.
Preventing other applications from creating window handles is truly a hack in my opinion and pretty bad one that I wouldn't appreciate as a customer of such software.
A constant BringWindowToTop() call to keep you in front is better (it doesn't break other software) but still a little hack-ish.
Catch window creation messages with a global hook. This way you can close or hide unwanted windows before they become visible.
EDIT: If you definitely want to avoid hooks, then you can call a function periodically, which puts your window to the top of the z-stack.
You could disable system updates http://support.microsoft.com/kb/901037 and remove the norton malware.
You could also connect a second screen so that the bubbles appear in the the first monitor.
Or you rewrite it for linux or windows ce.
One final option is to install software that reconfigures your os into a kiosk http://shop.inteset.com/Products/9-securelockdown.aspx
If you don't need keyboard or mouse input, how about running your application as a screensaver?
A lot of thoses messages are trigged/managed by Windows Explorer.
Just replace it with your dummy c#/winform.
By changing the registry value
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="Explorer.exe"
You can specify virtually any exe as an alternative to explorer.exe
That's the way all windows based (embedded) system (ATM & co) do.
There's still few adjustment (disable services you dont need / dr watson & others), and of course, you'll want to keep a "restart explorer.exe" backdoor.
But that's a good start

How do you debug Share Picker extensions?

I have registered my Phone 7 app as a Share Picker Extension. It works—my app is in the list of Share options and it gets launched and I can load the chosen image. Okay, great.
But then things go wrong in my code. I would like to be able to debug the issues, but I can't seem to keep the debugger attached.
I cannot debug this in the simulator, since the Pictures app (and thus the Share Picker functionality) is not present in the simulator.
I cannot debug this on the phone because as soon as I pick my app from the Share list, the debugger detaches... right as my app is "launching" again.
Is it possible to attach the debugger to a running WP7 app? Is it possible to keep the debugger attached? Am I doing it wrong? Any suggestions, advice or guesses are welcome because I'm tearing my hair out.
When doing M+V hub integration (sorry, haven't done any pictures hub integration yet) I initially used a crude debug technique (Messagebox.Show, etc. - like Justin mentioned) to verify what was being passed to the NavigationEventArgs of OnNavigatedTo and wrapped the whole method in a try..catch block to learn what was going on. I then refactored the code when I knew what could be expected. (Remember OnNavigatedTo will be called when your app is launched normally too and so e won't be populated in the same way.)
When the app is launched from a/the hub it creates a new instance of the app and there is currently no way to connect to this for debugging while the main page is being navigated to.
Great question. I'm unsure if that's possible. As far as I know, there's no way to attach the debugger to when the WP7 O/S starts an app (which wasn't triggered by the debugger).
Photo Share picker extensibility, music+Video hub extensibility and other O/S extensibility points seem to not play nicely with the VS debugger. Normally I resort to MessageBox.Show to debug any problems with WP7 O/S integration.
1) Connect the Device
2) Turn off Zune
3) Start C:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\WPConnect\x86\WPConnect.exe
To properly debug your application that uses the Media Library, you'll need to use the Windows Phone Connect Tool (WPConnect.exe) as described on MSDN. Jaime has some additional tips on his blog.
Once you are connected, you should be able to debug your application. Fingers crossed anyway. If that doesn't help, I'll dig a bit further.
It's not so much about the WPConnect tool. The nature of your application means that you have to have it closed and the user should pick a photo. Only after that the data is returned to the application.
You should read about the application execution model on Windows Phone 7. Also a good explanation is available here.
Initially, I would say that you should look at tombstoning (a good explanation here) but then again, the image returned will re-start the app and won't allow you to directly attach the debugger.
Yeah, looks like this is impossible...
All the answers above seem to be missing the point: I presume you're able to debug your app in the "standalone" mode (when it's launched normally), but not when it's launched via the Share Picker Extension. Am I write? This is the wall I'm hitting... :-(
I thought the proper way would be to attach to the process once it's launched.
I tried to use Debug > Attach to Process, then select Smart Device as the Transport and Windows Phone Device as the Qualifier... But in return I get the ugly "Unable to connect to 'Windows Phone Device'. Not implemented" message.
Bummer :-(

prevent screen capture

i am developing a video player i silverlight
i wanna something to prevent recording or screen capturing
i thought about hacking the windows APIs and stop my program from running if there was any of those capturing software asking the user to close it first but i donno how to do this
is there another solution ??!!!!
It's simple not possible. If you try it, you're only going to annoy people.
Even 'hacking the windows API' would not work, since the OS itself could be run inside a VM.
I hate to be a downer, but task is impossible to fully accomplish.
If you were somehow able to hook the keyboard (from a silverlight app no-less) I would certainly hope that whatever AV the user is running would throw up some red flags.
Also what if the user doesn't use the standard (alt)+prtscr? A third-party tool might use a different key-combo. Also, I've written a screen-grabber with the GDI+ API, and there's no way to disable something that low-level.
What about attached capture-cards? What if your app is running in a VM or over remote-desktop?
If you are that deeply concerned about protection your HD content, watermark it, or make the user pay for it first.
All-in-all, as soon as your content's data enters your user's computer, they can duplicate it.
You could go about using a key hook system, stopping the user pressing the print screen key on the keyboard, that would be a start. There aren't many systems which stop users from print screening video specifically. You might want to try just watermarking your video instead? At least then people know that the video was originally sourced from you.
The solution is not to allow your application to run on a computer, but instead target a device such as a phone. Computers will always allow some kind of screen capture and video capture but this is much harder and less likely to be tackled if you restrict to only playing on certain devices.
How badly do you need this? There are many ways to defeat screen capture protection: for instance, aiming a video recorder at the computer screen (or looping output to a TV with a capture card, etc. etc. etc.)
Go for a commercial solution if you really really need this: don't have any experience with those myself, however.

Resources