zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
459 stars 86 forks source link

need a better error message when a script tries to access a nonpublic symbol #57

Closed daveyostcom closed 5 years ago

daveyostcom commented 5 years ago

Example here.

Btw, why must a symbol be public to be usable from a script within the same class?

JonathanMagnan commented 5 years ago

I would have expected that protected would have worked as well.

We will look at it

Best Regards,

Jonathan

JonathanMagnan commented 5 years ago

Hello @daveyostcom ,

Is there a reason why you want access to the protected property? They are not public, you cannot access them either outside of your class, so why do you expect to be able to access them via our library?

daveyostcom commented 5 years ago

Well that's actually one of my questions: what is the execution environment of the compiled code? I assumed that it somehow runs in the context of the this that's passed to it.

JonathanMagnan commented 5 years ago

The run is code as if it was an external library that executes it (well, that's, in fact, the case). By default, we cannot register non public method via RegisterAssembly, since WAY too many members will be registered.

But we could add an overload that registers it, that's very easy.

So let say the execution environment is outside of your library.

daveyostcom commented 5 years ago

I have updated the comment in my example to explain this, in case anyone looks.

JonathanMagnan commented 5 years ago

Great ;)

Can we close this issue?

daveyostcom commented 5 years ago

Hi,

If you want, I could vastly improve your documentation. Here is something I posted today. I can give you more writing samples. https://stackoverflow.com/questions/55875809/graphviz-trouble-with-grid-layout-using-pos-attribute

I would start by asking you a bunch of questions to get to a deep understanding. Then present the information so everyone could get it immediately.

Best,

Dave https://www.linkedin.com/in/dave-yost-b34870/

On 2019-04-08, at 12:05 PM, Jonathan Magnan notifications@github.com wrote:

Great ;)

Can we close this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zzzprojects/Eval-Expression.NET/issues/57#issuecomment-480964800, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAiLJJpkNDK9DdTFmQC8_HiVbFcfzSGks5ve5MRgaJpZM4cd6o6.

JonathanMagnan commented 5 years ago

Hello @daveyostcom ,

Sure, you can contact me directly here: info@zzzprojects.com

Getting some help with the documentation is always appreciated ;)

Best Regards,

Jonathan