簡體   English   中英

調試器無法識別用戶設置

[英]debugger does not recognize User settings

我在應用程序設置中添加了以下設置:

名稱:類型:范圍:值:

ComboBoxItems字符串用戶我沒有在此處插入任何值

我聲明如下:

    public partial class postLoginWindow : Window
{
    private readonly string dbConnectionString = Properties.Settings.Default.dbConnectionString;
    private readonly string currentAdminEmail;
    private string ComboBoxItemsString = Properties.Settings.Default.ComboBoxItems;
    public postLoginWindow(string receivedAdminEmail)
    {
        InitializeComponent();
        LoadComboBoxValues();
        if (ComboBoxSelectedProfile.Items.IsEmpty)
        {
            ComboBoxSelectedProfile.IsEnabled = false;
            ButtonRenameProfile.IsEnabled = false;
            ButtonChangePermissions.IsEnabled = false;
            ButtonAddNewUser.IsEnabled = false;
            ButtonRemoveUser.IsEnabled = false;
            ButtonDeleteProfile.IsEnabled = false;
        }
...
     }
}

這是我用來將字符串值加載到comboBox的方法:

private void LoadComboBoxValues()
        {
            string[] ComboBoxRows = ComboBoxItemsString.Split('|');
            foreach (string Row in ComboBoxRows)
            {
                if (Row != "") ComboBoxSelectedProfile.Items.Add(Row);
            }
        }

這就是當我想將它們保存在設置字符串中時如何添加值:

private void ComboBoxAddItem(string item)
        {
            string[] ComboBoxRows = Properties.Settings.Default.ComboBoxItems.Split('|');
            bool ItemAlreadyExists = false;
            foreach (string Row in ComboBoxRows)
            {
                if (Row == item) ItemAlreadyExists = true;
            }

            if (!ItemAlreadyExists)
            {
                parent.ComboBoxSelectedProfile.Items.Add(item);
                string ComboBoxSavedProfileAsString = TxtProfileName.Text + "|";
                Properties.Settings.Default.ComboBoxItems = Properties.Settings.Default.ComboBoxItems +
                                                            ComboBoxSavedProfileAsString;
                Properties.Settings.Default.Save();
            }
        }

這是從另一個我在其中添加用戶的窗口完成的。

問題是:每當我進入DebugMode調試我的應用程序時,即使我確實向其中添加了一些字符串,它也會像設置字符串一樣為空。 所以我無法調試我的應用程序。

我非常感謝您的幫助!

請在“項目屬性”窗口中選中“啟用Visual Studio托管過程”選項。 禁用此選項時,之前添加的設置字符串將為空。 但是啟用此選項后,將顯示設置字符串值。

在此處輸入圖片說明

BIG感謝@Wendy-MSFT,感謝他/她/我找到了解決此問題的真正方法(基本上與她/他/她的Apache直升機建議的相反):

添加要在調試時包含的用戶設置

請注意:未選中=調試器將包括您添加到調試時間的用戶設置。

已檢查=調試器將忽略您添加到調試時間的用戶設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM