Hello,
The execution hangs at the return of localFolder.GetFileAsync()
because the execution of the main thread stops/hangs/waits on the Wait()
call.
You could either use await to wait for ReadIP()
:
public virtual **async Task** Awake()
{
**await** ReadIP();
}
or with timeout:
public virtual **async Task** Awake()
{
**await** Task.WhenAny(ReadIP(), Task.Delay(10_000));
}
or you can call ReadIP()
completely in a different thread:
public virtual void Awake()
{
Task.Run(() => ReadIP()).Wait(10_000);
}
I tried to make some words bold within **.