I have a Windows Phone 8.1 Universal App in which I am working on adding basic Cortana support. Many articles about this for Silverlight, etc. “It's hard for me to find really good information about this.”
So far, I have activated the work if the application is already running or paused. However, if the application completely exited, then upon activation it will immediately work. I tried using hockey and the simple “LittleWatson” procedure to catch a crash, but it seems like it's too early to be caught. I saw some links to a private beta and trying to get a dump of crashes, but so far I have been unlucky.
Here my activation code looks like app.xaml.cs :
protected override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); ReceivedSpeechRecognitionResult = null; if (args.Kind == ActivationKind.VoiceCommand) { var commandArgs = args as VoiceCommandActivatedEventArgs; if (commandArgs != null) { ReceivedSpeechRecognitionResult = commandArgs.Result; var rootFrame = Window.Current.Content as Frame; if (rootFrame != null) { rootFrame.Navigate(typeof(CheckCredentials), null); } } } }
and here is my check for the result of the command:
private async Task CheckForVoiceCommands() { await Task.Delay(1); // not sure why I need this var speechRecognitionResult = ((App)Application.Current).ReceivedSpeechRecognitionResult; if (speechRecognitionResult == null) { return; } var voiceCommandName = speechRecognitionResult.RulePath[0]; switch (voiceCommandName) { // omitted } ((App)Application.Current).ReceivedSpeechRecognitionResult = null; }
I am sure that I am inserting messages, etc., that he fails long before he gets to this.
Most likely something light, but I don’t know what ...
What causes a disaster so early?
EDIT . One thing I tried is to use the "debug without launch" configuration to try to catch the exception. When I do this, the application seems to forever and forever connect in the debugger on the splash screen. However, this allowed me to take a break. He hangs in
global::Windows.UI.Xaml.Application.Start((p) => new App());
which, as far as I can tell, just tells me that the application is hanging somewhere. This is the only line in the call stack.