我是新來的StackOverflow和一般的編程,所以如果我沒有正確解釋事情,提前很抱歉。'System.StackOverflowException'發生在WindowsBase.dll中
我收到錯誤消息:
類型 'System.StackOverflowException' 未處理的異常發生在WindowsBase.dll
時,下面的代碼獲取到window.Show()
public MainWindow()
{
myApp.Common.AppInfo.Local = "en-GB";
SoftwareMaintenance.Seed();
myApp5Db.Init(typeof(myAppDb_SQL2008));
myAppDb.Init();
if (myAppDb.IsValid)
{
Node.LoadTree(Node.ROOT); //loading the first level only
}
InitializeComponent();
}
protected override void OnStartup(StartupEventArgs e)
{
DefaultTraceListener traceListener = new DefaultTraceListener();
PresentationTraceSources.Refresh();
PresentationTraceSources.DataBindingSource.Listeners.Add(traceListener);
PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error;
base.OnStartup(e);
if (true)
{
MainWindow window = new MainWindow();
window.Show();
}
}
現在我已經在網絡上做了大量的研究,一切都指向一個被卡住的循環。在我的情況下,我不認爲這是事實,因爲另一個開發人員機器可以正常運行代碼。
這臺電腦與HP EliteBook 8670p完全一樣,只是內存更大。我的一個8GB的,其他16GB的[這可能是這個原因嗎?]
軟件方面都運行Windows 8.1 x64,Visual Studio 2013.每臺機器上的SQL Server的不同,我的機器運行SQL Server 2012開發人員版,其他SQL Server 2008標準。
// The Call Stack after window.Show()
[Managed to Native Transition]
// First 3 Call Stack's showed once
WindowsBase.dll!MS.Win32.SafeNativeMethods.GetKeyboardLayout(int dwLayout)
PresentationCore.dll!System.Windows.Input.TextServicesManager.PostProcessInput(object sender, System.Windows.Input.ProcessInputEventArgs e)
PresentationCore.dll!System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(System.Windows.Input.ProcessInputEventHandler postProcessInput, System.Windows.Input.ProcessInputEventArgs processInputEventArgs)
// The next 9 lines are repeated over 20+ times
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea()
PresentationCore.dll!System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject newFocus, System.Windows.Input.IKeyboardInputProvider keyboardInputProvider, bool askOld, bool askNew, bool forceToNullIfFailed)
PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject focus, bool askOld, bool askNew, bool forceToNullIfFailed)
PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement element)
InfragisticsWPF4.Controls.Interactions.XamDialogWindow.v14.1.dll!Infragistics.Controls.Interactions.XamDialogWindow.DialogManager.XamDialogWindow_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, bool reRaised)
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args)
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args)
我只是想添加一個WPF項目,在.NET 4.5上。 –
什麼方法是'window.Show();'in?從上面的片段看來,它看起來像是在任何方法之外。 – ClickRick
您需要顯示'if(true)'塊所在的方法。此外,來自異常的堆棧跟蹤的副本應該會有所幫助 –