The problem here is that your UploadFiles
method is not async
and does not return a Task
. If you are uploading from a file, you can use one of the asynchronous methods to accomplish that. Something like
public async Task<bool> UploadFiles(List<Item> selectedFiles)
{
string filePath = @"c:\temp\Data.txt";
using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
using var streamReader = new StreamReader(fileStream);
string data = await streamReader.ReadToEndAsync();
return data.Contains("spam");
}