C# 由于未处理的异常,此行中断了我的应用程序
由于未处理的异常,此行中断了我的应用程序C# 由于未处理的异常,此行中断了我的应用程序,c#,android,xamarin,cross-platform,C#,Android,Xamarin,Cross Platform,由于未处理的异常,此行中断了我的应用程序 var client = new HttpClient(); var responseMessage =await client.GetAsync("http://localhost:63650/api/student"); //HttpContent content = responseMessage.Content; //var json = await content.ReadAsStringAsync(); var RestUrl = "h
var client = new HttpClient();
var responseMessage =await client.GetAsync("http://localhost:63650/api/student");
//HttpContent content = responseMessage.Content;
//var json = await content.ReadAsStringAsync();
var RestUrl = "http://localhost:63650/api/student";
var uri = new Uri(string.Format(RestUrl, string.Empty));
var response = await client.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var item = JsonConvert.DeserializeObject<List<Student>>(content);
}
var-client=new-HttpClient();
var responseMessage=await client.GetAsync(“http://localhost:63650/api/student");
//HttpContent=responseMessage.content;
//var json=await content.ReadAsStringAsync();
var RestUrl=”http://localhost:63650/api/student";
var uri=新的uri(string.Format(RestUrl,string.Empty));
var response=await client.GetAsync(uri);
if(响应。IsSuccessStatusCode)
{
var content=await response.content.ReadAsStringAsync();
var item=JsonConvert.DeserializeObject(内容);
}
添加一个try-catch,找出没有处理的异常,并进行处理。您在哪一行获得此异常,以及异常的信息是什么?哪一行是“this”第行和异常是什么?添加一个try-catch,找出没有被处理的异常并进行处理。您在哪一行获得此异常以及异常的信息是什么?哪一行是“this”行以及异常是什么?