2017-12-06 20 views
-1

WPFアプリケーションはVS2015でデバッグモードで正常に動作します。しかし、デバッグなしで起動するとアプリケーションが起動し、直ちに終了します。 Debug/Releaseフォルダからexeファイルを起動する場合も同様です。 イベントビューアには、次の.NETランタイムエラーを示していますwpfアプリケーションはデバッグモードで実行されますが、デバッグなしでは実行されません。

Application: Cisco.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException at MS.Internal.Data.PropertyPathWorker.CheckReadOnly(System.Object, System.Object) at MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32, System.Object, System.Object) at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32, System.ComponentModel.ICollectionView, System.Object, Boolean) at MS.Internal.Data.ClrBindingWorker.AttachDataItem() at System.Windows.Data.BindingExpression.Activate(System.Object) at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt) at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean) at MS.Internal.Data.DataBindEngine+Task.Run(Boolean) at MS.Internal.Data.DataBindEngine.Run(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.MessageBox(System.Runtime.InteropServices.HandleRef, System.String, System.String, Int32) at System.Windows.MessageBox.ShowCore(IntPtr, System.String, System.String, System.Windows.MessageBoxButton, System.Windows.MessageBoxImage, System.Windows.MessageBoxResult, System.Windows.MessageBoxOptions) at System.Windows.MessageBox.Show(System.String) at Cisco.App.OnStartup(System.Windows.StartupEventArgs) at System.Windows.Application.<.ctor>b__1_0(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run(System.Windows.Window) at Cisco.App.Main()

私は同じ問題を持つ多くの質問があることを知っているが、解決策はまだ私の問題を修正していません。

実行中のMainWindowも表示されません。だから、すべてのOnStartupメソッドをtry catchブロックに移動して、この例外をMessageBoxで識別しようとしましたが、MessageBoxも表示されません。

public partial class App : Application 
{ 
    void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) 
    { 
     e.Handled = true; 
    } 


    protected override void OnStartup(StartupEventArgs e) 
    { 
     try 
     { 
      base.OnStartup(e); 

      Ioc.Setup(); 

      Current.MainWindow = new MainWindow(); 

      Current.MainWindow.Show(); 
     } 
     catch (Exception ex) 
     { 
      MessageBox.Show(ex.Message); 
     } 
    } 
} 

solutionをGoogleドライブにアップロードしました。たぶんそれはもっと役に立つだろう。

+0

コードなしでは、問題が何であるかは言うまでもありません。問題の位置を特定するためにコードをコメントアウトしてみてください。それは、MessageBox(またはcatchブロックに1つありますか?)またはBindingのいずれかと関連しているようです。 –

+0

あなたのソリューションを実行する前に。あなたのアプリはシステムのファイルに書き込み/削除しますか?それは私のマシン上で実行するために保存されますか?してください、あなたの答えを確認してください! –

+0

それについて心配しないでください。このプロジェクトはあなたのPCのために完全に安全です。システムファイルやレジストリエントリに変更はありません。 –

答えて

0

最後に、原因を見つけました。 この問題は、private setterを持つpublic変数へのtwoWayバインディングに関連していました。このセッターを公開アプリケーションにすると、正常に実行されます。

関連する問題