how to debug wp8 app downloaded from store? - windows-phone-8

I've made a game using marmalade sdk and AppEasy engine and it works when I test it on the device but after submitting to store and downloading it only shows splash screen and then terminates.
Is there a way to debug it? Android and ios both have tools to trace the console output, is there such a tool for wp8? I only found how to do that for apps deployed to the device locally but no way to debug downloaded apps :(
For my other game made in same framework (with same issue) there is a crash report on the dev center dashboard with error saying 'STACK_OVERFLOW_DATA' but that doesn't help much
also tried this (solution found in some other question):
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
string result = "nothing :(";
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
if (store.FileExists("iwtrace.txt"))
{
using (var stream = new IsolatedStorageFileStream("iwtrace.txt", FileMode.Open, store))
{
using (var fileReader = new StreamReader(stream))
{
result = fileReader.ReadToEnd();
}
}
}
EmailComposeTask task = new EmailComposeTask();
task.To = "";
task.Subject = "crash log " + e.ExceptionObject.Message;
task.Body = result;
task.Show();
}
but it never get's to showing the email form

There's no way yet to debug retail version of WP8 apps especially which are made in Marmalade.
You can read more about that in the article explaining how to test the retail version.
According to the article you need to test the retail version via Visual Studio in case of Native C# app. I suppose even native XAML apps can't be debugged after downloading from store.
I've asked almost similar question on Marmalade forums last year. The only way at that time was to use Windows Power tool or Visual Studio.
To test the function, run your code from Visual Studio in release mode and see if it crashes or not. That's the only thing you can do in this case as far as I know.

Related

Windows Phone 10 File Save Picker Not Working

I'm having trouble getting the "file save picker" contract working in Windows Phone 10 for my Universal Windows App. I've added both "File Save Picker" and "Cached File Updater" declarations to the app manifest.
It works fine for me on a full Windows 10 computer (tested Mail and Mobile Word).
When I try it on a phone running WP10, I get a native exception A heap has been corrupted (parameters: 0x77344270) with error code 0xc0000374. No part of the stacktrace leads into my app.
My TargetFileRequested listener:
private async void FileSavePickerUI_TargetFileRequested(
FileSavePickerUI sender,
TargetFileRequestedEventArgs args)
{
var deferral = args.Request.GetDeferral();
var filePath = GetSelectedFilePath();
args.Request.TargetFile = await StorageFile.GetFileFromPathAsync(filePath);
CachedFileUpdater.SetUpdateInformation(
args.Request.TargetFile,
CachedFileListener.CreateContentId(contentId, destination),
ReadActivationMode.NotNeeded,
WriteActivationMode.AfterWrite,
CachedFileOptions.None);
deferral.Complete();
}
I'm overriding OnCachedFileUpdaterActivated(CachedFileUpdaterActivatedEventArgs args), but it never gets called (app crashes before here).
Again, it only crashes in WP10. Win10 works fine.
Note: sometimes it doesn't appear to crash, but the updater method is still never called.
I have also tried this sample here:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/FilePickerContracts
And I get similar results in that OnCachedFileUpdaterActivated is only ever called on desktop not phone.

Azure Mobile Services authentication not working with Windows Phone 8.1 Universal app

I'm adding Azure Mobile Services authentication to a Universal Windows project. It's all set up and working properly on the server and in the Windows Store version of the app, however I can't get it to work with the Windows Phone 8.1 version of the app. I actually have two different apps that I've been working on with the same problem, so I created a test app based strictly on the steps outlined in this article. The sample app has one button on the UI that will attempt authenticate the user with Twitter when pressed.
The flow that I am seeing from the UI is:
Press the button
Screen goes black for a moment
Screen displays "Resuming..." with a spinner
InvalidOperationException gets caught
The exception details:
System.InvalidOperationException was caught
HResult=-2146233079
Message=Authentication was cancelled by the user.
Source=mscorlib
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.WindowsAzure.MobileServices.MobileServiceAuthentication.<LoginAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at MobileAuthTest.MainPage.<AuthenticateAsync>d__3.MoveNext()
InnerException:
The code I am using is copied almost verbatim from the article, but I'll paste it here too:
private async void Button_Click(object sender, RoutedEventArgs e)
{
await this.AuthenticateAsync();
}
// Define a method that performs the authentication process
// using a Twitter sign-in.
private async Task AuthenticateAsync()
{
while (user == null)
{
string message;
try
{
// Change 'MobileService' to the name of your MobileServiceClient instance.
// Sign-in using Twitter authentication.
user = await App.mobileService
.LoginAsync(MobileServiceAuthenticationProvider.Twitter);
message =
string.Format("You are now signed in - {0}", user.UserId);
}
catch (InvalidOperationException)
{
message = "You must log in. Login Required";
}
var dialog = new MessageDialog(message);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
}
And this override is in App.xaml.cs:
protected override void OnActivated(IActivatedEventArgs args)
{
// Windows Phone 8.1 requires you to handle the respose from the WebAuthenticationBroker.
#if WINDOWS_PHONE_APP
if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation)
{
// Completes the sign-in process started by LoginAsync.
// Change 'MobileService' to the name of your MobileServiceClient instance.
mobileService.LoginComplete(args as WebAuthenticationBrokerContinuationEventArgs);
}
#endif
base.OnActivated(args);
}
My testing is all on a real Windows Phone 8.1 device (Nokia 920 with 8.1 update).
It's also worth pointing out that the project I'm currently trying to get this to work in is also using Xamarin.Forms for Android, iOS and Windows Phone (I wanted a comparison between Xamarin.Forms for Windows Phone and Universal apps for Windows Phone). All of the apps work, EXCEPT for the two Windows Phone apps. The Xamarin.Forms Windows Phone app is a Windows Phone Silverlight 8.1 app which acts the same as described above for the Universal WP, but fails with the error, "Authentication failed with HTTP response code 0."
I've searched around and haven't found any other cases of people encountering the same issue I am. Is there something I need to do that is so simple nobody feels the need to say it in writing?
Well, it turns out that the issue I am seeing may just be my device. I sent the sample app to another dev for testing and he had no issues. I also was able to successfully log in with both the sample app and the real app on the simulator. That isn't exactly a thorough test sample, but it's enough for me to stop banging my head on this desk.

Windows Phone 8.1 Voice Commands App Activation

I want to integrate some voice commands in my windows phone 8.1 app.
The first thing I want to do is to open my app by a voice command and navigate to a certain page.
According to MSDN article Quickstart: Voice commands (XAML) I can use the override of protected virtual void OnActivated(IActivatedEventArgs args) method in App.xaml.cs to meet my requirements. But it does'nt work the way I though it would!
I have the method with the following structure:
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.VoiceCommand)
{
var commandArgs = args as VoiceCommandActivatedEventArgs;
if (commandArgs != null)
{
// ... some logic here
}
}
}
The problem is when I'm activating my app by saying "Open 'name of my app' [optional words]" the app opens but the Activated event never fires! The app opens and OnLaunched event fires. So I can't even enter the OnActivated method.
Does anyone know the problem? Why can't I enter OnActivated method using voice commands?
P.S. I tried it with a simulator as well as with a real device.
you can see this article,
http://t.co/Q5hRxRPvwR
is in spanish, but you will understand.
After you install the app and run it, the xml should be installed, like said in documentation.
After ask to cortana "What can I say?" it will show all you can said, and the apps that supports cortana. Choose you app and you will see what you can say for your app, like
If you say what your app can listen, your app will be activated.

Unauthorized Access Exception when Creating an instance of SpeechSynthesizer in WP8.1 Emulator

I was trying to recreate the simle Text to Speech example used on the MSDN website. However whenever the code came to create the instance of the SpeechSynthesizer class it failed with a Unauthorised Acception error when running on the WP8.1 emulator. I currently do not have an actual device to test on to see if this makes a difference.
My code was simply:
private async void TTS()
{
// The media object for controlling and playing audio.
MediaElement mediaElement = new MediaElement();
// The object for controlling the speech synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
// Generate the audio stream from plain text.
SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World");
// Send the stream to the media object.
mediaElement.SetSource(stream, stream.ContentType);
mediaElement.Play();
}
I know there was an issue with the SpeechSynthesizer in Windows 8.1, and I found solutions to this when looking to fix the problem, but found little about the problem with WP8.1 SpeechSynthesizer. Has anybody else came across this problem and found a fix?
You should add one DeviceCapability in Package.appxmanifest file:
In DeviceCapability Tab, check the microphone, because it will provides access to the microphone’s audio feed, which allows the app to record audio from connected microphones.
Look at this library: App capability declarations (Windows Runtime apps)

Geolocator.GetGeopositionAsync throw "Class not registered" exception c#

I run next code in blank project and got "Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
private Windows.Devices.Geolocation.Geolocator locator = new Windows.Devices.Geolocation.Geolocator();
private async void Button_Click(object sender, RoutedEventArgs e)
{
try
{
var position = await this.locator.GetGeopositionAsync();
}
catch (Exception ex)
{
//Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
}
}
Also, I tried to run Geolocation Sample 8.1 (c# and JS) but got the same exception and I tried to run this sample not on 1 PC and not on 1 network. All the same.
I have win8.1 rtm and VS2013 RC on my laptop.
Also, I run this code and Microsoft sample on ARM tablet with 8.1 Pro preview (with GNSS module) and on tablet(i5-3317U Processor and without GPS module) with 8.1 rtm. I didn't get this exception and all works fine. So I think it only occured on PC/Simulator.
How to test GeoLocation app on PC/Simulator?
The code works, I tested this on my computer:
private async void Button_Click(object sender, RoutedEventArgs e)
{
var locator = new Windows.Devices.Geolocation.Geolocator();
var position = await locator.GetGeopositionAsync();
}
I tested both on Windows 8 with Visual Studio 2012 as well as Windows 8.1 (Preview) and Visual Studio 2013 (preview). As long as the capabilities were set there were no problems. I did not download the sample, the code is fairly straight forward to write even for complex scenarios. Look at the sample for inspiration, but code your own. Always easier not having to debug somebody elses logic :)
Code was tested 'on pc' as well as simulator (although there shouldn't be a difference since the simulator IS your PC as it remote desktop's to your own computer)
Make sure that you set capabilities for location:
Use the location option in the simulator to set a specific address if you want:
My breakpoint
If all fails, do the usual. Uninstall the app, clean and rebuild, restart computer and Visual Studio, and check that the location capability is set by using getting the charm bar once the app is installed and running, and select permissions. It should say that it has permissions, see below:
Best of luck!
Test this code on 8.0 - work fine.
On 8.1 rtm still got class not registered exception.
I think I need to add some library, but don't know where.
UPD:
I found where is problem.
I have Pro N version of win 8.1. In Pro N this code throw exception.
On Enterprise and Pro versions all work fine.
As said "zedkommander" above, error com from "N" version of windows 8.
But he didn't give the solution, so i'm going to give it :
Microsoft employee confirmed this problem :
This behaviour is indeed specific to the “N” editions. For geolocation to work on N-editions of Windows, the Microsoft Media Feature Pack needs to be installed.
Geolocation has a dependency on WPD (Windows Portable Devices) infrastructure which is not present in N editions until the feature pack is installed.
If you want to fix it, you need to install "Microsoft Media Feature Pack" by clicking here : https://www.microsoft.com/fr-fr/download/details.aspx?id=30685