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

Simple Custom Functions are not getting registered #274

Open
skocherlakota opened this issue May 15, 2023 · 1 comment
Open

Simple Custom Functions are not getting registered #274

skocherlakota opened this issue May 15, 2023 · 1 comment

Comments

@skocherlakota
Copy link

I was looking for a working reference to implement a call to custom function and found below
#272 (comment)
But it gives me the following error "Unable to find specific method!" when i tired. Please note i'm using JUST.Net 4.3.0
image

Module Program
    Sub Main(args As String())
        Dim transformer As String = String.Empty
        Dim transformedString As String = String.Empty
        Dim jsStr As String = String.Empty
        jsStr = File.ReadAllText(Directory.GetCurrentDirectory() + "\input.json")
        Dim context = New JUSTContext()
        context.RegisterCustomFunction(Nothing, "JUST.UnitTests.Helper", "ReturnValue", "returnValue")
        transformer = File.ReadAllText(Directory.GetCurrentDirectory() + "\inputTransformer.json")
        transformedString = New JsonTransformer(context).Transform(transformer, jsStr)
        Console.Write(transformedString)
        Console.ReadLine()
    End Sub
End Module
Namespace JUST.UnitTests
    Public Class Helper
        Public Shared Function ReturnValue() As String
            Return "Works"
        End Function
    End Class
End Namespace
@Courela
Copy link
Contributor

Courela commented May 17, 2023

Is it on the same DLL as the transformer? If not, you have to pass the name of the DLL as first argument instead of null/Nothing

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

No branches or pull requests

2 participants