You code looks fine, although you shouldn't need this line:
engine.Execute(@"moduleLoader.LoadModuleAsync(this, 'jsdom', jsdomPath);");
requirecall on the next line should call the module loader internally. Also, be careful with this:
engine.Execute(@"var String = System.String;");
Stringfunction, which could affect subsequent scripts.
I have a first chance exception handler, code still runs. Not 100% sure why the code behaves like this!
How are you setting up this handler? It's not in the code above. We're glad you found a way forward, but we'd really like to understand your original issue, and we still can't reproduce it with
ModuleLoaderdefined in a separate class library. Would it by any chance be possible for you to share your project?