I have this piece of code which is always throwing a null ref exception even if the variable is not null and I can see its value:
httpClient.DownloadDocumentML(req)
.ContinueWith(t =>
{
string x = t.Result.Document.DocumentData;
byte[] arrayFile = Encoding.ASCII.GetBytes(x);
byteArrays.Add(arrayFile);
t.Wait();
trash = byteArrays;
Session["multipleFiles"] = byteArrays;
//return Json("multiple");
});
The bytearrays variable is alywas throwing null ref exception but its value is not null.