Forum Community

an exception occurred during the operation making the result invalid

OmarMohOmarMoh USMember ✭✭
edited July 2018 in Community

Hi xamarin developers

I'm building new xamarin.forms app that connected with asmx web service , after adding the web reference (web service) into my xamarin.forms app project and start testing, the app is crashing and the following error listed :

1- an exception occurred during the operation making the result invalid
2- invalid name character in ''. the ' ' character hexadecimal value 0x20 cannot be included in a name

I built xamarin.forms app with asmx web service that connected to mySQL DB before and was works fine, I build this project like same concept of previous project but i dont know what is the problem .

xaml
`


`

.cs
`ServiceReference1.WebServiceSoapClient sr;

    public testAppPage()
    {
        InitializeComponent();

        xtest.Clicked += Xtest_Clicked;
    }

    void Xtest_Clicked(object sender, System.EventArgs e)
    {
        sr = new WebServiceSoapClient();
        sr.Login_as_customerAsync("omar","12345"); //send user name & pass to web service
        sr.Login_as_customerCompleted += LoginCompleted;

    }

   private void LoginCompleted(object sender, ServiceReference1.Login_as_customerCompletedEventArgs e)
    {
        Device.BeginInvokeOnMainThread(() =>
        {
            try
            {  
                if (e.Result.ValidUser) // returned value from web service
                {
                    xres.Text = "true";
                }
                else
                {
                    xres.Text = "false";
                }
            }catch(Exception ex){
                xres.Text = ex.Message.ToString() +"\n"+ex.InnerException.Message.ToString();
            }
        });
    }

`
I putted the event in try / catch to avoiding the crash and receive the error message on the app.
if someone want the web service link I will give him ,for testing the app for trying help me and give me the project and
thanks

Answers

  • OmarMohOmarMoh USMember ✭✭
    edited July 2018

    <Button Text="Test" x:Name="xtest" /> <Label x:Name="xres" TextColor="Red"/>

Sign In or Register to comment.