views:

14

answers:

1

Hey, In Silverlight client I get error but it always looks like :

An exception occurred during the operation, making the result invalid. Check InnerException for exception details.

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at SecretaryAppNav.ClientService.GetChildAndOpiekunByFirstnameLastnameCompletedEventArgs.get_Result() at SecretaryAppNav.Views.FindChild.Client_GetChildAndOpiekunByFirstnameLastnameCompleted(Object sender, GetChildAndOpiekunByFirstnameLastnameCompletedEventArgs e) at SecretaryAppNav.ClientService.Service1Client.OnGetChildAndOpiekunByFirstnameLastnameCompleted(Object state)

In client files I always use try catch to catch erorrs but it never invoke, :

        void Client_GetChildAndOpiekunByFirstnameLastnameCompleted(object sender, GetChildAndOpiekunByFirstnameLastnameCompletedEventArgs e)
    {
        try
        {
            this.dataForm1.ItemsSource = e.Result.Collection;
        }
        catch (FaultException ex)
        {
            System.Windows.Browser.HtmlPage.Window.Alert(ex.Reason.ToString() +  ex.Code.ToString() );
            throw new FaultException(ex.Reason, ex.Code, "Klikanie");
        }
    }

Should I put this catch in my service files to catch SOAP errors ? Without more info I always searching for mistake in my code like in the dark ... :/

+1  A: 

If you're debugging your application and you want to simply catch every exception, you do this:

catch (Exception ex)
{
    System.Windows.Browser.HtmlPage.Window.Alert(ex.Reason.ToString())
}

You may want to re-throw the exception after that or check to see what type of exception it is, but this can be a useful way to catch exceptions in Debug mode.

You also might put a break point on the line of code that catches the general exception. This will allow you to "watch" the exception when it is thrown and then look at its nested inner exception(s).

Ben McCormack
oh yeah! now I see it :)
netmajor