-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hi,
I am trying to do a POC creating a function that allows an asynchronous call with unlimited number of arguments. When adding async Task as the return type the fixed arguments in the function are always empty and only the params are populated. If I return object the fixed arguments are available.
Not sure if I am doing something incorrectly or there is a bug.
Sample code below:
using System;
using System.Net;
using System.Diagnostics;
using ExcelDna.Integration;
using ExcelDna.Registration;
using ExcelDna.Logging;
namespace test
{
public class AddIn : IExcelAddIn
{
public void AutoOpen()
{
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
Trace.Listeners.Add(new LogDisplayTraceListener());
ExcelRegistration.GetExcelFunctions()
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
.ProcessParamsRegistrations()
.RegisterFunctions();
}
public void AutoClose()
{
}
}
}
using System;
using System.Threading.Tasks;
using System.Diagnostics;
using ExcelDna.Integration;
namespace test
{
public static class MyFunctions
{
[ExcelFunction(Description = "Returns a value")]
public static async Task<object> NotWorking([ExcelArgument(Name = "Arg1", Description = "Arg 1")] string arg1,
[ExcelArgument(Name = "Argument", Description = "Arg 2, Arg 3, etc")]params string[] args)
{
try {
var result = arg1 + ", " + String.Join(", ", args);
Trace.TraceInformation(result);
Trace.Flush();
return result;
} catch (Exception ex){
Trace.TraceError(ex.Message);
Trace.Flush();
return ex.Message;
}
}
[ExcelFunction(Description = "Returns a value")]
public static object Working([ExcelArgument(Name = "Arg1", Description = "Arg 1")] string arg1,
[ExcelArgument(Name = "Argument", Description = "Arg 2, Arg 3, etc")]params string[] args)
{
try {
var result = arg1 + ", " + String.Join(", ", args);
Trace.TraceInformation(result);
Trace.Flush();
return result;
} catch (Exception ex){
Trace.TraceError(ex.Message);
Trace.Flush();
return ex.Message;
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels