第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

查找拋出的 WPF 異常的類/行號(hào)

查找拋出的 WPF 異常的類/行號(hào)

C#
HUX布斯 2021-11-14 10:21:20
System.ArgumentOutOfRangeException由于用于訪問 a 中的項(xiàng)目的錯(cuò)誤索引DataGrid(發(fā)生在已發(fā)布的版本上并且沒有進(jìn)行用戶交互)而引發(fā)了A 。遵循我們收到的堆棧跟蹤的一部分:System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.Parameter name: index   at System.Windows.Media.VisualCollection.get_Item(Int32 index)   at System.Windows.Controls.UIElementCollection.get_Item(Int32 index)   at System.Windows.Controls.UIElementCollection.System.Collections.IList.get_Item(Int32 index)   at System.Windows.Controls.DataGridCellsPanel.ArrangeOverride(Size arrangeSize)   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)   at System.Windows.UIElement.Arrange(Rect finalRect)   at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)   at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)   [...]在堆棧跟蹤的進(jìn)一步下方,我們還可以看到虛擬化DataGrid在引發(fā)異常的地方處于活動(dòng)狀態(tài)。該錯(cuò)誤很可能與延遲加載/虛擬化有關(guān),但是,它發(fā)生在哪里仍然是個(gè)謎。是否可以配置 WPF 或手動(dòng)添加信息以跟蹤引發(fā)異常的位置?(至少是哪個(gè)類/控件/頁面/窗口,甚至可能是哪個(gè)綁定)
查看完整描述

2 回答

?
呼喚遠(yuǎn)方

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超11個(gè)贊

我懷疑你最好的辦法是通過內(nèi)存轉(zhuǎn)儲(chǔ)來診斷問題。如何獲得一個(gè),取決于你的異常處理代碼是如何設(shè)置的。

如果您的應(yīng)用程序本身處理異常(并且不會(huì)崩潰),則很難生成轉(zhuǎn)儲(chǔ)。您可以嘗試此處概述的方法:自動(dòng)生成 .NET 故障轉(zhuǎn)儲(chǔ)?;蛘?,如果您在拋出異常時(shí)讓應(yīng)用程序保持活動(dòng)狀態(tài)(使用對(duì)話框或其他東西),您可以要求用戶獲取內(nèi)存轉(zhuǎn)儲(chǔ)以進(jìn)行進(jìn)一步分析(通過任務(wù)管理器 => 右鍵單擊進(jìn)程 => 創(chuàng)建轉(zhuǎn)儲(chǔ)) .

如果您的應(yīng)用程序真的崩潰了,可以自動(dòng)創(chuàng)建一個(gè)轉(zhuǎn)儲(chǔ)文件,但這需要在注冊(cè)表中進(jìn)行配置(參見https://blogs.msdn.microsoft.com/tess/2010/08/23/getting-full-user -mode-dumps-automatically-when-your-process-crashes/ , https://www.meziantou.net/2018/06/04/tip-automatically-create-a-crash-dump-file-on-error ) .


查看完整回答
反對(duì) 回復(fù) 2021-11-14
?
牛魔王的故事

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超3個(gè)贊

我在 App.xaml.cs 文件中做了類似下面的事情


  /// <summary>

/// Interaction logic for App.xaml

/// </summary>

public partial class App : Application

{

    static string filePath = System.IO.Path.Combine(Environment.GetFolderPath(

    Environment.SpecialFolder.ApplicationData), "Log.txt");

    private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)

    {

        using (StreamWriter writer = new StreamWriter(filePath, true))

        {

          writer.WriteLine("Message :" + e.Exception.Message + "<br/>" + Environment.NewLine + "StackTrace :" + e.Exception.StackTrace +  "" + Environment.NewLine + "Date :" + Now.ToString());

          writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);

        }

        MessageBox.Show("An unhandled exception just occurred: " + e.Exception.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Warning);

        e.Handled = true;

    }

}

希望它會(huì)幫助你


查看完整回答
反對(duì) 回復(fù) 2021-11-14
  • 2 回答
  • 0 關(guān)注
  • 409 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)