Xamarin HttpClient GetStringAsync 不起作用

问题描述

首先,我想说我尝试了我在这里和其他论坛上找到的所有解决方案。因此,我再次写一个关于同一主题的问题。

我尝试使用 HttpClient 获取数据,但总是以失败告终。

代码

#version 330 core
layout(location = 0) in vec2 vert_pos;
layout(location = 1) in vec2 tex_pos;

uniform mat3 trans1;
uniform mat3 trans2;

out vec2 texPos;

void main()
{
    vec3 pos = vec3(-vert_pos.y,vert_pos.x,0.0f);
    vec3 rst;
    if(pos.y < 0.0f)
    {
        rst = pos;
        texPos = tex_pos;
    }
    else if(pos.y > 0.0f)
    {
        rst = pos;
        texPos = vec2(1.0f,1.0f);
    }
    gl_Position = vec4(rst.x,rst.y,0.0f,1.0f);
    //texPos = tex_pos;
}

代码总是在 await client.GetStringAsync(url); 处停止工作;

控制台输出

protected override void OnCreate(Bundle savedInstanceState)
{
    ...
    SetContentView(Resource.Layout.activity_main);

    GetData(_url);
}

async void GetData(string url)
{
    var handler = new httpclienthandler();
    HttpClient client = new HttpClient(handler);
    string result = await client.GetStringAsync(url);

    Console.WriteLine(result);
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)