I had a problem to download a file ( an Image ) and someone recommended to me to do asynchronously.
I changed my code so :
Async Function _take_file(ByVal _file As String) As Task
....
Dim client As HttpClient = New HttpClient()
Dim _Request As HttpRequestMessage = New HttpRequestMessage(HttpMethod.Post, "https://content.dropboxapi.com/2/files/download")
_Request.Headers.Add("Authorization", "Bearer " + _token)
_Request.Headers.Add("Dropbox-API-Arg", _parametro)
Dim _response As HttpResponseMessage = Await client.SendAsync(_Request)
Dim _responseStream As Stream = Await _response.Content.ReadAsStreamAsync()
Dim myStreamReader As New StreamReader(_responseStream)
I have an error on the last line :
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll