Skip to content
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

ExtensionMethod is used even if matching prototype method exists #851

Closed
windischb opened this issue Mar 23, 2021 · 0 comments · Fixed by #861
Closed

ExtensionMethod is used even if matching prototype method exists #851

windischb opened this issue Mar 23, 2021 · 0 comments · Fixed by #861

Comments

@windischb
Copy link
Contributor

I'm not sure if this is a bug or i'm just confused....
I have an ExtensionMethod in C#:

    public static class StringExtensions
    {
        public static string[] Split(this string value, string split, StringSplitOptions options)
        {
            return new string[0];
        }
    }

which i added to the Jint Options:

var engine = new Engine(opts =>
{
    opts.AddExtensionMethods(typeof(StringExtensions));
});
var arr = engine.Execute("'yes,no'.split(',')").GetCompletionValue().AsArray();

Here i get an exception, because Jint wants to use the ExtensionMethod, but missing some Arguments.
Shouldnt jint uses the "builtin" javascript split Method before trying to invoke the extensionMethod?

github test repo: https://github.com/windischb/JintTest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant