0

私は C++/CLI にはあまり詳しくありませんが、ずっと前に C++ をいくつかやりました。プロジェクト内のメソッド内AccessViolationExceptionで WebKit.NET に入っているものをデバッグしようとしています。例外を引き起こすコード行は次のとおりです。JSContext::EvaluateScriptJSCore

JSValueRef result = NULL;

try
{
    result = JSEvaluateScript(_context, jsScript, /*(JSObjectRef)jsObj*/NULL, NULL, 0, &exception);
}
catch(...)
{
}

このエラーはランダムに発生します。私は知っ_contextjsScriptいて、null ではありません。奇妙なことに、エラーが発生すると、Program.cs ファイルが開き、Application.Run(new Form1());行に例外が表示されますがTargetInvocationException、IntelliTrace で、このAccessViolationException直前に、上記の行の直前でこれが発生していることがわかります。これが原因となっている例外であると想定してTargetInvocationExceptionください。

また、(result = JSEvaluateScript...)の上の行にブレークポイントを設定し、その後に別のブレークポイントを設定すると、最初のブレークポイントがヒットし、次に F10 を押しても 2 つ目がヒットしないため、最初のブレークポイントで例外が発生するはずです。 1。また、 dllJSEvaluateScript内にあるWebKitため、踏み込むことはできません。

また、try/catch元々存在しなかった が例外をキャッチしていないようで、何が起こっているのかわかりません。アプリケーションで一連のアクションを実行することでエラーを再現できますが、これらのアクションがエラーの原因である理由がわかりません。ほとんどの場合、同じパラメータで を呼び出してJSContext::EvaluateScriptも例外は発生しません。

これを診断する方法に関するアドバイスはありますか?私はアイデアがありません。

編集:さらにデバッグを行ったところ、他のランダムな行でもエラーが発生する可能性があります。したがって、上記の行とは関係がないと確信しています。

編集 2:スタック トレースは次のとおりです。

>   JSCore.dll!WebKit.JSCore.JSContext.EvaluateScript(string script = {unknown}, object thisObject = {unknown}, string sourceUrl = {unknown}, int startingLineNumber = {unknown})   
    JSCore.dll!WebKit.JSCore.JSContext.EvaluateScript(string script = {unknown})    
    WebKitBrowserTest.exe!Player.WebKitWraps.JSObjectWrap.GetExpando()  
    WebKitBrowserTest.exe!Get Player.WebKitWraps.JSObjectWrap.Expando() 
    WebKitBrowserTest.exe!Player.WebKitWraps.JSObjectWrap.Equals(Player.WebKitWraps.JSObjectWrap other = {Player.WebKitWraps.ElementWrap})  
    WebKitBrowserTest.exe!Player.WebKitWraps.JSObjectWrap.op_Equality(Player.WebKitWraps.JSObjectWrap a = {Player.WebKitWraps.ElementWrap}, Player.WebKitWraps.JSObjectWrap b = {Player.WebKitWraps.ElementWrap})   
    WebKitBrowserTest.exe!Player.WebKitWraps.JSObjectWrap.op_Inequality(Player.WebKitWraps.JSObjectWrap a = {Player.WebKitWraps.ElementWrap}, Player.WebKitWraps.JSObjectWrap b = {Player.WebKitWraps.ElementWrap}) 
    WebKitBrowserTest.exe!WebScraperAndPlayer.SelectionEditor.SelectPrevSibling(WebScraperAndPlayer.BrowserSelector selector = {WebScraperAndPlayer.BrowserSelector})   
    WebKitBrowserTest.exe!WebScraperAndPlayer.SelectionEditor.WillSelectAny(System.Action<WebScraperAndPlayer.BrowserSelector> selectFunction = {System.Action<WebScraperAndPlayer.BrowserSelector>})   
    WebKitBrowserTest.exe!WebScraperAndPlayer.SelectionEditor.UpdateAbilities() 
    WebKitBrowserTest.exe!WebScraperAndPlayer.SelectionEditor.SetExecutionState(Player.Actions.ExecutionState value = Stopped)  
    WebKitBrowserTest.exe!Set WebScraperAndPlayer.SelectionEditor.ExecutionState(Player.Actions.ExecutionState value = Stopped) 
    mscorlib.dll!System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo method = {unknown}, object target = {unknown}, object[] arguments = {unknown}, System.Signature sig = {unknown}, System.Reflection.MethodAttributes methodAttributes = {unknown}, System.RuntimeType typeOwner = {unknown})  
    mscorlib.dll!System.Reflection.RuntimeMethodInfo.Invoke(object obj = {unknown}, System.Reflection.BindingFlags invokeAttr = {unknown}, System.Reflection.Binder binder = {unknown}, object[] parameters = {unknown}, System.Globalization.CultureInfo culture = {unknown}, bool skipVisibilityChecks = {unknown})   
    mscorlib.dll!System.Reflection.RuntimeMethodInfo.Invoke(object obj = {unknown}, System.Reflection.BindingFlags invokeAttr = {unknown}, System.Reflection.Binder binder = {unknown}, object[] parameters = {unknown}, System.Globalization.CultureInfo culture = {unknown})  
    mscorlib.dll!System.Reflection.MethodBase.Invoke(object obj = {unknown}, object[] parameters = {unknown})   
    System.dll!System.SecurityUtils.MethodInfoInvoke(System.Reflection.MethodInfo method = {unknown}, object target = {unknown}, object[] args = {unknown}) 
    System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {unknown}, object value = {unknown}) 
    System.Windows.Forms.dll!System.Windows.Forms.Binding.SetPropValue(object value = {unknown})    
    System.Windows.Forms.dll!System.Windows.Forms.Binding.PushData(bool force = {unknown})  
    System.Windows.Forms.dll!System.Windows.Forms.Binding.PushData()    
    System.Windows.Forms.dll!System.Windows.Forms.BindingManagerBase.PushData(out bool success = {unknown}) 
    System.Windows.Forms.dll!System.Windows.Forms.BindingManagerBase.PushData() 
    System.Windows.Forms.dll!System.Windows.Forms.PropertyManager.OnCurrentChanged(System.EventArgs ea = {unknown}) 
    System.Windows.Forms.dll!System.Windows.Forms.BindToObject.PropValueChanged(object sender = {unknown}, System.EventArgs e = {unknown})  
    System.dll!System.ComponentModel.PropertyDescriptor.OnValueChanged(object component = {unknown}, System.EventArgs e = {unknown})    
    System.dll!System.ComponentModel.ReflectPropertyDescriptor.OnValueChanged(object component = {unknown}, System.EventArgs e = {unknown}) 
    System.dll!System.ComponentModel.ReflectPropertyDescriptor.OnINotifyPropertyChanged(object component = {unknown}, System.ComponentModel.PropertyChangedEventArgs e = {unknown}) 
    WebKitBrowserTest.exe!Player.Project.BasicProject.NotifyPropertyChanged(string propertyName = "ExecutionState") 
    WebKitBrowserTest.exe!Player.Project.BasicProject.SetInternalExecutionState(InternalExecutionState value = Stopped) 
    WebKitBrowserTest.exe!Player.Project.BasicProject.execData_ExecutionCompleted(object sender = {Player.Actions.ExecutionData}, Player.Actions.ExecutionCompletedEventArgs e = {Player.Actions.ExecutionCompletedEventArgs})  
    WebKitBrowserTest.exe!Player.Actions.ExecutionData.OnExecutionCompleted(Player.Actions.ExecutionCompletedEventArgs e = {Player.Actions.ExecutionCompletedEventArgs})    
    WebKitBrowserTest.exe!Player.Actions.ExecutionData.ReportExecutionCompleted(Player.Actions.StopException exception = null)  
    WebKitBrowserTest.exe!Player.Actions.Executor.ProcessExecutionCompleted(Player.Actions.StopException exception = null)  
    WebKitBrowserTest.exe!Player.Actions.Executor.StartNextSegment()    
    WebKitBrowserTest.exe!Segment.Conclude()    
    WebKitBrowserTest.exe!<>c__DisplayClass5.AnonymousMethod()  
    WebKitBrowserTest.exe!Player.Actions.Waiter.OnCallbackFunction()    
    WebKitBrowserTest.exe!Player.Actions.Waiter.Complete()  
    WebKitBrowserTest.exe!Player.Actions.Waiter.AnonymousMethod()   
    mscorlib.dll!System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo method = {unknown}, object target = {unknown}, object[] arguments = {unknown}, System.Signature sig = {unknown}, System.Reflection.MethodAttributes methodAttributes = {unknown}, System.RuntimeType typeOwner = {unknown})  
    mscorlib.dll!System.Reflection.RuntimeMethodInfo.Invoke(object obj = {unknown}, System.Reflection.BindingFlags invokeAttr = {unknown}, System.Reflection.Binder binder = {unknown}, object[] parameters = {unknown}, System.Globalization.CultureInfo culture = {unknown}, bool skipVisibilityChecks = {unknown})   
    mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args = {unknown})   
    mscorlib.dll!System.Delegate.DynamicInvoke(object[] args = {unknown})   
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme = {unknown})  
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj = {unknown}) 
    mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData = {unknown})  
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}) 
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}, bool ignoreSyncCtx = {unknown}) 
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}) 
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme = {unknown})    
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks()    
    System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m = {unknown})   
    System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m = {unknown}) 
    System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m = {unknown})  
    System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m = {unknown})  
    System.Windows.Forms.dll!ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m = {unknown})  
    System.Windows.Forms.dll!ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m = {unknown})    
    System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd = {unknown}, int msg = {unknown}, System.IntPtr wparam = {unknown}, System.IntPtr lparam = {unknown})  
    System.Windows.Forms.dll!ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID = {unknown}, int reason = {unknown}, int pvLoopData = {unknown})   
    System.Windows.Forms.dll!ThreadContext.RunMessageLoopInner(int reason = {unknown}, System.Windows.Forms.ApplicationContext context = {unknown}) 
    System.Windows.Forms.dll!ThreadContext.RunMessageLoop(int reason = {unknown}, System.Windows.Forms.ApplicationContext context = {unknown})  
    System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm = {unknown})   
    WebKitBrowserTest.exe!WebScraperAndPlayer.Program.Main(string[] args = {string[0]}) 
4

0 に答える 0