With the extended registration planned to Excel-DNA 1.9, we support both Task-based async methods and for 'unknown' data types we support object handles. But currently these can't be mixed. We should consider whether to extend the type conversions into the async methods
For example, all the Async functions here fail with #VALUE
using System.Threading.Tasks;
using ExcelDna.Integration;
namespace TestAsyncObject190
{
public class MyData
{
public string Name { get; set; }
public int Value { get; set; }
}
public class Functions
{
[ExcelFunction]
public static MyData GetData(string name)
{
var result = new MyData { Name = name, Value = name.Length };
return result;
}
[ExcelFunction]
public static string GetName(MyData data)
{
return data.Name;
}
[ExcelFunction]
public static int GetValue(MyData data)
{
return data.Value;
}
[ExcelFunction]
public static async Task<MyData> GetDataAsync(string name)
{
await Task.Delay(1);
var result = new MyData { Name = name, Value = name.Length };
return result;
}
[ExcelFunction]
public static async Task<string> GetNameAsync(MyData data)
{
await Task.Delay(1);
return data.Name;
}
[ExcelFunction]
public static async Task<int> GetValueAsync(MyData data)
{
await Task.Delay(1);
return data.Value;
}
}
}
With the extended registration planned to Excel-DNA 1.9, we support both Task-based async methods and for 'unknown' data types we support object handles. But currently these can't be mixed. We should consider whether to extend the type conversions into the async methods
For example, all the Async functions here fail with #VALUE