A colleague reported that a C++/CLI sample app (which was previously working) using ClearScript was failing when calling AddHostObject with an InvalidOperationException "Invalid host item".
I've been able to reproduce the error on my computer, with
- the same C++/CLI project
- a new C++/CLI project
- a new C# project
I've also reproduced in 5.5.3 (which is what we use) and 5.5.4 (in a new project using the Nuget package) and with .NET 4.6.1 and 4.7.2.

Here's the code for my new C# project:
static void Main(string[] args)
{
using (var engine = new V8ScriptEngine())
{
engine.AddHostObject("message", "hello world");
}
}
Given how it was working and suddenly seems to not be working it may be an environmental thing like Windows Updates but I'd appreciate some pointers.
I was trying to attach a sample but Github was unhappy with the size. When I get chance (might be Monday) I'll attach a Dropbox link or something.
A colleague reported that a C++/CLI sample app (which was previously working) using ClearScript was failing when calling AddHostObject with an InvalidOperationException "Invalid host item".
I've been able to reproduce the error on my computer, with
I've also reproduced in 5.5.3 (which is what we use) and 5.5.4 (in a new project using the Nuget package) and with .NET 4.6.1 and 4.7.2.
Here's the code for my new C# project:
Given how it was working and suddenly seems to not be working it may be an environmental thing like Windows Updates but I'd appreciate some pointers.
I was trying to attach a sample but Github was unhappy with the size. When I get chance (might be Monday) I'll attach a Dropbox link or something.