You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a relatively simple project that just registers one or two classes with V8 from C#. When using AOT publishing, an exception occurs during operation. I downloaded the source code and debugged it step by step, and determined that the exception was caused by calling binder.Bind:
The exception information is as follows:
Error: Object reference not set to an instance of an object.
at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.Invoke(Action1) + 0x9d at Microsoft.ClearScript.V8.SplitProxy.V8ContextProxyImpl.InvokeWithLock(Action) + 0x64 at Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke[T](Func1) + 0x82
at TestAot.Program.Main(String[] args) + 0x111
I guess this problem may be caused by dynamic calling, which is incompatible with AOT. This function is called only once in the following location:
My idea is that if dynamic calling is not supported (using RuntimeFeature.IsDynamicCodeSupported for judgment), reflection is used to obtain the matching method. After a simple test, the corresponding method can be called normally after modification.
I would like to ask if it is appropriate to modify BindMethodRaw if reflection is used to obtain MethodInfo. Are there any other points that need attention?
The text was updated successfully, but these errors were encountered:
My idea is that if dynamic calling is not supported (using RuntimeFeature.IsDynamicCodeSupported for judgment), reflection is used to obtain the matching method.
Have you tried disabling the default method binding algorithm via DisableDynamicBinding?
I have a relatively simple project that just registers one or two classes with V8 from C#. When using AOT publishing, an exception occurs during operation. I downloaded the source code and debugged it step by step, and determined that the exception was caused by calling binder.Bind:
public static DynamicMetaObject Bind(DynamicMetaObjectBinder binder, object target, object[] args)
{
return binder.Bind(CreateDynamicTarget(target), CreateDynamicArgs(args));
}
The exception information is as follows:
Error: Object reference not set to an instance of an object.
at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.Invoke(Action
1) + 0x9d at Microsoft.ClearScript.V8.SplitProxy.V8ContextProxyImpl.InvokeWithLock(Action) + 0x64 at Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke[T](Func
1) + 0x82at TestAot.Program.Main(String[] args) + 0x111
I guess this problem may be caused by dynamic calling, which is incompatible with AOT. This function is called only once in the following location:
private static object BindMethodRaw(BindingFlags bindFlags, InvokeMemberBinder binder, HostTarget target, object[] bindArgs)
{
}
My idea is that if dynamic calling is not supported (using RuntimeFeature.IsDynamicCodeSupported for judgment), reflection is used to obtain the matching method. After a simple test, the corresponding method can be called normally after modification.
I would like to ask if it is appropriate to modify BindMethodRaw if reflection is used to obtain MethodInfo. Are there any other points that need attention?
The text was updated successfully, but these errors were encountered: