Visual Studio 2017 studio showing error 'This application is in break mode' and throws unhandled exception

橙三吉。 提交于 2020-12-30 07:58:05

问题


I am developing a Xamarin.Android app. Whenever i try to download a JSON feed I get the error "Your app has entered a break state, but there is no code to show because all threads were executing external code".

Here's the screenshot of 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 got error at this line

    string content = await contentsTask;

  • This is my json

    { "posts":[ { "id":"1", "url":"", "title":"Convert Speech to Text in Android Application", "date":"2017-06-16 06:15:18", "content":"Convert Speech to Tex Convert Speech to Text in Android Application Convert Speech to Text in Android Applicationt in Android Application", "thumbnail":"http:\/\/stacktips.com\/wp-content\/uploads\/2017\/01\/Speech-to-Text-in-Android-375x300.jpeg" } ] }

Please can anybody tell me whats wrong with my code ? Thanks in advance..

Here's my php 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);

     }
   ?>               

回答1:


I'm surprised yet not best answer posted for this issue. For me above solutions didn't work. To resolve this issue, I'd to disable following option from debug menu.

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

For more details, check microsoft msdn help.




回答2:


You should be getting exception details and a call stack, which will greatly aid in your debugging efforts. I think this is a bug with Xamarin on VS2017 right now.




回答3:


I ran across this error and looked in the output window after the application failed. In my case I had a method in a view model class with a "Task" that is invoked by the XMAL.




回答4:


At last i got the answer.

Problem was with my hosting server, server response with cookies in it. That's why my android app unable to parse the json.

Thanks for help.




回答5:


In my particular case I checked the debug output window and it mentioned "Cannot find or open the PDB file." I further read and one of the solutions was to check what static variable references I was making. I had a static variable loading from the AppSettings and it was referencing a key that was not present in the app.Config file. I wish the debugger told me directly the reference not found or something like that. Once I had the correct reference key, I was on my way. Hoping this will help somebody else.




回答6:


In case it helps someone:

The output tab was giving me a message saying that the dll version was incorrect.

The project ran anyway, but for some reason this dll version made my project to go to break mode, I deleted the dll, used a previous version, and now I can debug without problems



来源:https://stackoverflow.com/questions/44418120/visual-studio-2017-studio-showing-error-this-application-is-in-break-mode-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!