-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
I'm not sure if this is supposed to work, but my use case is that I want to load a module once, then pass it around to various constructors using dependency injection so that they can call methods.
So I do
await _nodeJS.SynchronizationContext.RunAsync(async () =>
{
JSReference cspellModule = new(await _nodeJS.ImportAsync("./loadcspell", esModule: true));
builder.RegisterInstance(cspellModule);
}And then later on I receive this reference in a constructor and try to call a method:
await _nodeJS.SynchronizationContext.RunAsync(async () =>
{
var spellCheckFileMethod = (JSPromise)cspellModule.GetValue().CallMethod("spellCheckFile", ...);
var spellCheckFileResults = await spellCheckFileMethod.AsTask(context.CancellationToken);
}And got this:
Microsoft.JavaScript.NodeApi.JSException
HResult=0x80131500
Message=Invalid argument: Error in Call at D:\a\_work\1\s\src\NodeApi\JSValue.cs:666
StackTrace:
<Cannot evaluate the exception stack trace>
It works when loading the module locally.
Metadata
Metadata
Assignees
Labels
No labels