Skip to content

httpclient.GetAsync issue when using UWP #13

@ccarlo88

Description

@ccarlo88

Hello!

First, congrats for the .NET API for Matrix! It worked really well with the Console example and is nice to have a SDK developed in .NET. I was making some testes with the sdk and when using UWP it hangs out here:

public MatrixRequestError Get (string apiPath, bool authenticate, out JToken result)
{
apiPath = GetPath (apiPath,authenticate);
Task task = client.GetAsync(apiPath); //Here more exactly
var res = RequestWrap(task);
res.Wait();
result = res.Result.result;
return res.Result.error;
}

The GetAsync function will never return.... and it will hang everything around after that. The reason is explained here:
https://stackoverflow.com/questions/10343632/httpclient-getasync-never-returns-when-using-await-async/10351400#10351400

I looked around the code and one (not nice) solution would be immediately after each Async httpclient task like GetAsync/PostAsync, to call task.Wait(). Of course if you make Async methods you could use the await keyword with the async methods when calling them.

I didn't implement it because I think you know better than I what to do in the SDK and you know Matrix/Synapse much much better than I. Keep on the good job and please don't let me alone in the .NET! 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions