Forum Xamarin.Android

Xamarin Android, Throw new Exception(Exception)

AtanasAngelovAtanasAngelov Member ✭✭✭

There was something that i was wanting to ask for some time now, and that would be when the try catch has an exception, in this situation when i try to connect to the server to run an SQL command, when i put my username and password as nothing to see whats going to happen, it does show in VS that indeed there is a exception, and therefore i am using throw new exception("test") for example. However every time that i do that in the catch, most of the time the app crashes and i have to restart it and it leaves an error of System.UnhandledException. I have went into the Internet to possible find a solution but i am yet to find anything. To conclude how the app works, you input your details, for example Username admin Password admin, it then checks if the user is in the system, then it checks for their rights and if there is anything wrong it should display the exception. (The way that i connect to the server is vie a different CS file) IF anybody knows how i can handle that, it would be great.

Best Answer


  • jezhjezh Member, Xamarin Team Xamurai

    Hi @AtanasAngelov , according to your description, it is difficult for us to locate the problem.Could you please post the full error log about your question?

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    basically, what i am trying to do is to execute a query to the database returning whether this user exists, if it does then its going to return with their ID and continue, however when i try to log in without a username and password i have set it to "throw new Exception(custom exception)" which in fact return to me Unhandled Exception and it crashes the app, what i wanted it to do is, throw the exception and not crash the app, which resulted into me adding a Toast.MakeText.

Sign In or Register to comment.