-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TargetParameterCountException when returning params in 2.5.1677 #299
Comments
I have not found any version where it was working. There was no implicit conversion from Promise to Task (but there is opposite conversion. Probably, it's a bug). |
Year, sorry. This example shows the regression: using Microsoft.VisualStudio.TestTools.UnitTesting;
using NiL.JS;
using NiL.JS.BaseLibrary;
using NiL.JS.Core;
using NiL.JS.Extensions;
using System;
using System.Threading.Tasks;
namespace Tests.Fuzz
{
[TestClass]
public sealed class Bug_XXX
{
[TestMethod]
public async Task ReturnParamsFromAsyncFunction()
{
var script = Script.Parse(
@"
export default class Test {
async run(params) {
return params;
}
}
"
);
var context = new GlobalContext();
var module = new Module($"main.js", script, context);
module.Run();
var ctor = module.Exports.Default.As<Function>();
var instance = ctor.Construct(new Arguments());
var run = instance.GetProperty("run").As<Function>();
var param = JSON.parse("{}");
var result = run.MakeDelegate<Func<JSValue, JSValue>>()(param);
if (result.Value is Promise promise)
{
result = await promise.Task;
}
Assert.AreEqual(param, result);
}
}
} |
@nilproject Have you been able to trigger the regression with the above example? |
Yeah, thanks, i've fixed this |
The following used to work:
However, it now throws
TargetParameterCountException
. The regression is introduced in commit f2ea242The text was updated successfully, but these errors were encountered: