Displaying Error Page in WP7 app - windows-phone-7

Just want to check I have not missed anything obvious. There is no way to Navigate the user to a "ooops something bad has happened" page from the UnhandledException handler is there?
What is everyone else doing
I know I can "handle" the error and popup up messagebox but I would prefer a whole page offering them the oppurtunity to file a bug report.
The samples I have seen simply set the RootFrame directly but I have seen that just makes for a messy UI with what looks like a Page displayed on top of another page
TIA
Pat

If you get an UnhandledException it occurs while your applicaiton is about to be shut down. The best you can do in this situation is warn the user that something went wrong (using a messagebox or similar) but be prepared that this may not be displayed to the user for long, depending on the actual exception.
Rather than try and continue executing application functionality when an unhandled exception occurs, simply save the details of the exception. Then, when the application is next started, display a message to the user to indicate that "the last time that app ran there was a problem". You can also use this opportunity to send exception details to yourself/ your web reporting service so you can analyse the issues and fix/prevent them in a future version.

You can call RootFrame.Navigate(your errorPage) to navigate to your custom error page in the UnhandledException handler.
Basically, using a custom MessageBox to show a nice easy-going error info and providing an button to send bug report is very common. And this article is MSDN pointed out that errorinfo not be a separate page in best practice.

Related

Bot Framework returning to wrong dialog

I've got a stubborn problem trying to forward a message to a FormFlow dialog from within a LUIS dialog. The code I'm using to do so is:
var timeRegistrationDialog = new FormDialog<TimeRegistrationDialog>(new TimeRegistrationDialog(), TimeRegistrationDialog.BuildForm, FormOptions.PromptInStart, entities);
context.Call<TimeRegistrationDialog>(timeRegistrationDialog, this.ResumeAfterTimeRegistration);
This seems to be in line with the samples out there. What happens next though
The form flow dialog is created
The bot asks for the first field
I enter a valid value
When sent, the default LUIS intent triggers instead of the next step of the form flow
This is probably also related to what I posted here: https://github.com/Microsoft/BotBuilder/issues/1956. Probably not a bug but an error on my part; trying to resume a conversation from an oauth callback also fails because the framework seems unable to locate the right dialog. I based it completely on the AuthBot sample which seems super similar but doesn't have the issue.
So in general, it appears that I'm doing something wrong that causes the wrong dialog to be returned from the stack (or no dialog at all). I just have no clue what. A not up-to-date version of the code is located here: https://github.com/mstack/bots-jennifer. Not up-to-date, but has similar issues so should be sufficient to track any errors. Should any more be required I can post it.

No ajax action fired after session invalidate

We have a JSF webapp with Primefaces 4.0 and CAS Single Sign On.
When a user requests an ajax action (by clicking a p:commandButton or similar component with ajax=true) after he has lost his session because SSOut in another tab, nothing happens, no response from server or action is triggered.
We need to manage that situation to inform the user that his session is no longer available, by showing a dialog or redirecting him to home or a custom page, but we don't know how.
ajax=false solves the problem, but this is not what we want to do.
No ViewExpiredException is thrown.
EDIT:
We had already read and tried this BalusC's solution without success. No Exception is thrown and Handler has nothing to do. Note that isn't an Expired Session or Invalidated by TimeOut session, is just an explicit session.invalidate caused by Cas Sign Out in another tab.
We also tried javascript jsf.ajax.addOnError() solution, and again nothing to capture.
Only p:ajaxStatus onError event catches something, but no way to identify that particular error. Even overriding ajaxStatus javascript function, error data parameter is undefined...
Also, p:log says "Request return with error:error." but, which error is it? how do we identify it?
We are stuck on this issue...
This has been discussed many times, and as far as know there aren't any out-of-the-box solutions yet. One solution is to add a custom ExceptionHandler as stated in this post.
Another option is to register client error handler using jsf.ajax.addOnError(...), and to handle this exception in it. You might need some server code to add a custom header in case session is invalid, which you would use in error handler to be able to differentiate that specific case from other errors.

How to continue a Cucumber step after an unpredictable modal dialog pops up?

I have a Ruby and Watir-webdriver -based Cucumber test suite for a web application and that web application relies on a service to provide some of its data through a sort of search.
There's a lot of data in this external service and sometimes the search will take a long time. When this happens, a modal dialog pops up on the web application. We really can't predict when that will happen and it isn't very practical to throw in browser.alert.ok calls throughout all of my step definitions.
So far, we've been handling the issue with an After hook that simply drops and restarts the browser. This saves the test suite during our full runs, but it doesn't help the test in question.
Long story short, I'd like a way to simply catch the Selenium::WebDriver::Error::UnhandledAlertError exception (the associated message is "Modal dialog present") whenever it pops up in a step, recognize what's happening (probably by matching the exception type and text, then matching the modal dialog text), and continue the step from the line we were at when the exception caused the interruption. Any thoughts?
I think you just need something like:
step /^some code$/ do
begin
#Your actual step
end
rescue
browser.alert.ok
next
end
I encountered a similar problem in my project, where I used to get random fatal error dialogs.
The approach I followed is to handle the dialog in AfterStep hook. Since in cucumber every step is atomic, after every step I verify whether the fatal error dialog is present. If it is there then click OK and proceed with the execution.
Hope this helps for you.

Handle Incoming call crash while App Start

I have run into an Interesting scenario. Its also present here by someone on msdn forums
When I launch my application, if I lock the screen or if a call comes at that time and on resume after unlocking or disconnecting the call in respective scenarios, the application crashes throwing 0x8000ffff error. This I have observed also happens when an emailcomposetask is open from my application.
Previously I thought that it was because I was not handling Obscured and Unobscured. But now that I am handling them, still I am receiving the same case. I have observed that many other applications also crash but there are some applications like Facebook and Twitter which are able to handle it. Has any one faced this same situation? Can you please provide me a fix for this?
Am I doing anything wrong?
also note that I have changed my default loading page. Its not mainPage.xaml but xyz.xaml, where I am checking for tokens and redirecting user to mainPage automatically without any button click.
Edit : Added StackTrace
at Microsoft.Phone.Execution.NativeEmInterop.NotifyFullObscurityChanged(Boolean isObscured)
at Microsoft.Phone.Shell.PhoneApplicationService.OnFullObscurityChanged(Object sender, LockStateChangeEventArgs e)
at Microsoft.Phone.Shell.Interop.ShellPageManager.ShellPageCallback_OnLockStateChange(Object source, LockStateChangeEventArgs e)
at Microsoft.Phone.Shell.Interop.ShellPageCallback.FireOnLockStateChange(Boolean fLocked)`
This mainly happens because of the code in OnNavigatedTo() and Page_Loaded() event handlers. Place break points and check for the issues in those two methods.
When an app is resumed in the cases you mentioned, these two methods are called in the same order.
Hope this solves your problem.
Update based on your comments:
There you are. You are clearing the entire Navigation history, and hence it dont know where to go now(even the current page is removed).
My suggestion is, Move your back history removal code from OnNavigated to the Page_Loaded event.

Error hosting Silverlight application page with WCF service

I am currently developing a Silverlight application with WCF service. The process flow of my project is as follows.
Silverlight page -> Service1.svc -> SQL Server 2008 and back
What my Silverligth page does is when a user clicks a button it calls a service reference (Service.svc). What the service is doing basically is to query a SQL database (SQL server 2008) and return the query back to the service and in turn the service returns the result back to the Silverlight page where it will be displayed.
When I am debugging and running the webpage from the visual Studio 2010 express all the things go according to plan i.e. when the user clicks the button the data that were acquired from the database are displayed.
But when I try to publish this and run it on Apache server or IIS I am getting an error when clicking the button. The web page is displayed correctly even from another internally connected PC, but the problem occurs when I press the button.
An error message is displayed as shown below:
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at SilverlightApplication11.ServiceReference1.DoWorkCompletedEventArgs.get_Result()
at SilverlightApplication11.About.client_DoWorkCompleted(Object sender, DoWorkCompletedEventArgs e)
at SilverlightApplication11.ServiceReference1.Service1Client.OnDoWorkCompleted(Object state)
-------------------------------->
I have abosolutley no idea on how to solve this. I am very new to this whole stuff please help I been stuck in this about a week now.
Any snippets of code you guys would like please comment so I can post it here.
Thanks in advance =)
The service call you're making has an equivalent event to tap into. Your handler will be called when the operation completes or fails. The event args passed to your handler will contain information about your error. Keep digging into inner exception until something makes sense.
Also, your silverlight's App.xaml.cs has the ability to do something when an exception is thrown. There's an event called UnhandledException you can tap into. From there, you can output more information for yourself about the InnerException. Sometimes the first exception is not helpful, but there will be an InnerException in the Exception that will have more detail.

Resources