Hi guys. I have a little interesting question about using async/await inside Sanderling program. So, I have 2 async function and I want to run them parallel with Task.WhenAny. Like this: Task<string> firstFinishedTask = await Task.WhenAny(new List<Task<string>>{WaitForMiningModulesStops(), WaitForOreHoldlFills()});
This 2 function pretty similar:
async Task WaitForMiningModulesStops()
{
while(isModulesActive)
Host.Delay(500);
Because the Sanderling IDE only supports running C# script. The C# compiler does not support the code you posted since it tries to return a string from a method which is declared to return a bool.
You can see this by hovering your mouse cursor over the squiggles in the editor or by looking at the error messages in the static diagnostic section.
In there, you see the following error message, pointing to the line with the return statement:
Cannot implicitly convert type ‘string’ to ‘bool’
The screenshot below shows where you can see this in the App:
Oh, I have fixed it in Sanderling, but haven’t fixed it there. So, Task.WhenAny doesn’t work at me after I have fixed those mistakes. It seems like tasks froze and Task.WhenAny never return result.