Hi Ron,
Yes, it has to do with the way ClearScript binds to .NET type members. For most things it uses reflection, but for methods it uses the C# runtime binder. These facilities have different rules for accessing non-public resources.
Try using
From the ClearScript Library Reference: "By setting this property to a type you declare that script code running in the current script engine is to be treated as if it were part of that type's implementation. Doing so does not expose any host resources to script code, but it affects which host resources are importable and which members of exposed resources are accessible."
Hopefully this solution is practical in your actual scenario.
Good luck!
Is there a reason why the property is accessible and the method is not?
Yes, it has to do with the way ClearScript binds to .NET type members. For most things it uses reflection, but for methods it uses the C# runtime binder. These facilities have different rules for accessing non-public resources.
Try using
ScriptEngine.AccessContext
. For example:
engine.AccessContext = typeof(Program);
Hopefully this solution is practical in your actual scenario.
Good luck!