The code above initially calls
On the other hand, properties created via
AddHostObject()
to create the "TEST1" global property. What you may not realize - most likely because of insufficient documentation on our part - is that AddHostobject()
creates a read-only global property. Subsequent reassignment is quietly ignored. This is by design - to prevent script code from clobbering the host's API, and to achieve compatibility with ClearScript's original JScript/VBScript behavior.On the other hand, properties created via
Script
can be reassigned normally. Instead of:V8JS.AddHostObject("TEST1", T1);
please try:V8JS.Script.TEST1 = T1;
Cheers!