How to get the value of a returned value from an async from an external function in PowerBuilder? I made a simple example in VB2013 .NET 4.5 and compiled it as a DLL. And inside the DLL is an async method like so:
test.DLL
public async Task<string> GetTestAsync()
{
Task<string> task = GetTest();
string test = await task;
return test;
}
public async Task<string> GetTest()
{
string test;
test = "TEST";
return test;
}
and I have called the DLL in PowerBuilder like so:
String test
test = String(myoleobject.GetPortsTestAsync())
if isnull(test) then
messagebox('', 'null value')
end if
The result always returns a null value.
I've also tried this one, but it still returns a null value.
public Task<string> GetTestAsync()
{
return Task.Factory.StartNew(() =>
{
return "hello";
});
}