You can't set a timeout on a per-method basis, but could do something like what is described at this link:
Crafting a Task.TimeoutAfter Method | Parallel Programming with .NET[
^]
My google search was "c# timeout with task".
Here's some minimal code that may work for you:
public static async Task TimeoutAfter(this Task task, int msTimeout)
{
msTimeout = (msTimeout <= 0) ? int.MaxValue : msTimeout;
if (task == await Task.WhenAny(task, Task.Delay(msTimeout)))
{
await task;
}
else
{
throw new TimeoutException();
}
}