2012-05-01 3 views
0

私のグラフィカルアプリケーションでは、すべてのページをイメージにエクスポートする機能がありますが、これを解決するためにどこから始めるべきかわからないこの例外があります:クロス依存ビューから無限ループが発生しているように見える

An infinite loop appears to have resulted from cross-dependent views. 

この例外の考え方を教えていただけますか?どのようにそれを解決するには?そのようなクラッシュの原因は何ですか?ここで

は、スタックトレースです:

at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 
    at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 
    at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
    at System.Threading.ExecutionContext.runTryCode(Object userData) 
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Windows.Threading.DispatcherOperation.Invoke() 
    at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
    at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
    at System.Windows.Application.RunDispatcher(Object ignore) 
    at System.Windows.Application.RunInternal(Window window) 
    at System.Windows.Application.Run(Window window) 
    at System.Windows.Application.Run() 
    at KETAB.KStudio.UI.SingleInstanceManager.OnStartup(StartupEventArgs e) in C:\Users\KETAB\Desktop\KStudio.V3.0.0_Official_Before_Gitex\KETABStudio\App.xaml.cs:line 555 
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() 
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) 
    at KETAB.KStudio.UI.SingleInstanceManager.Main(String[] args) in C:\Users\KETAB\Desktop\KStudio.V3.0.0_Official_Before_Gitex\KETABStudio\App.xaml.cs:line 536 
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ThreadHelper.ThreadStart() 

答えて

0

はよく見に任意のコードなしで行くことがたくさんはありませんが、私はとにかくそれに打撃を与えるでしょう。

最初の手順は、ビューの相互依存性を低くすることです。おそらく、彼らはお互いを見ているよりも、両方とも見ているモデルを持っています。

別の手順では、必要に応じて更新コードのみを更新することがあります。時には、別のコントロールを変更するコントロールを持っていて、他のコントロールが変更されたときにそれを更新するロジックを入れたら、本当に必要な変更がなければ、私のアップデートが呼び出されています。たとえば、イベントの結果によってコントロールのサイズが変更された場合は、新しい値を計算し、実際に変更された場合にのみサイズのプロパティを変更することができます。 (つまり、新しい値と同じではありません)

希望します。

+0

ありがとう、同じエラーメッセージが表示されましたか?何が問題を引き起こすのかを私たちに伝えることはできませんか?ロードされたページを仮想化しています。ビューリストを使用して、すべての要素がページにロードされたときに取得し、次のページに移動します。何度か、問題なくすべてのページをレンダリングしますが、回、約150ページ後にバグが発生します。 – simo

+0

問題は、エラーメッセージが表示されないことです。それはちょうど2つのウィンドウが変化し、それぞれが再帰的に更新されることになります。 1つの変更がもう一方の更新を引き起こさないような変更については、イベント処理を変更する必要があります。これにより、最初のウィンドウが再び更新されます(など).. – Curtis

+0

ありがとうございます。内部のwaitロジックでdo whileループを使って問題 – simo

関連する問題