Visual Studio 2017 shows an error "This application is in interrupt mode" and throws an unhandled exception

I am developing a Xamarin.Android application. Whenever I try to load a JSON feed, I get an error . "Your application has entered an interrupt state, but there is no code because all threads executed external code . "

Here is a screenshot of the error Here is a screenshot of the error

  • My json feed download code

    string url = "http://xamdev.epizy.com/getData1.php"; public async void downloadJsonFeedAsync(String url) { var httpClient = new HttpClient(); Task<string> contentsTask = httpClient.GetStringAsync(url); // await! control returns to the caller and the task continues to run on another thread string content = await contentsTask; Console.Out.WriteLine("Response Body: \r\n {0}", content); //Convert string to JSON object result = Newtonsoft.Json.JsonConvert.DeserializeObject<RootObject> (content); //Update listview RunOnUiThread (() => { listView.Adapter = new CusotmListAdapter(this, result.posts); progress.Visibility = ViewStates.Gone; }); } 
  • I have an error in this line

    string content = waiting for contentsTask;

  • This is my json

    {"position": [{"Identifier": "1", "URL": "," title ":" Convert speech to text in an Android application "," date ":" 2017-06-16 06:15: 18 "," content ":" Convert Speech to Tex Convert Speech to Text in an Android application convert speech to text in an Android application in an Android application "," Lenfilm ":" HTTP: \ / \ / stacktips.com \ / -content \ / downloads \ / 2017 \ / 01 \ /Speech-to-Text-in-Android-375x300.jpeg "}]}

Please someone tell me what happened to my code? Thanks in advance.

Here is my phs webservice code -

 <?php if($_SERVER['REQUEST_METHOD']=='GET'){ require_once('conn.php'); $sql = "SELECT * FROM space"; if ($result = mysqli_query($conn, $sql)) { $resultArray = array(); $tempArray = array(); while($row = $result->fetch_object()) { $tempArray = $row; array_push($resultArray, $tempArray); } echo json_encode(array("result"=>$resultArray)); } mysqli_close($conn); } ?> 
+5
source share
5 answers

I finally got the answer.

The problem was in my host server, the server response with cookies. This is why my Android application cannot parse json.

Thanks for the help.

0
source

You should receive exception information and a call stack, which will greatly help your debugging efforts. I think this is a bug with Xamarin on VS2017 right now.

+1
source

I ran into this error and looked in the output window after the application failed to execute. In my case, I had a method in the class of the view model with the "Task" called by XMAL.

+1
source

In my particular case, I checked the debug output window and mentioned "I can not find or open the PDB file." I read further, and one solution was to check which static variables I use. I had a static load of variables from AppSettings, and it referenced a key that was not in the app.Config file. I want the debugger to directly tell me a link not found or something like that. As soon as I had the correct reference key, I was on the go. Hope this helps someone else.

0
source

I am surprised, but not the best answer posted for this problem. For me, the above solutions did not work. To solve this problem, I would disable the following option in the debug menu.

 Debug > Options > General > Uncheck "Enable Just My Code" 

See microsoft msdn help for more details.

0
source

Source: https://habr.com/ru/post/1268639/


All Articles