调试器无法识别用户设置

debugger does not recognize User settings

我在应用程序设置中添加了以下设置:

名称:类型:范围:值:

ComboBoxItems String User 我没有在此处插入任何值

我声明如下:

    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;
        }
...
     }
}

这是我用来将字符串值加载到组合框中的方法:

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();
            }
        }

这是从我添加用户的另一个 window 完成的。

问题是:每次我进入 DebugMode 调试我的应用程序时,它都会出现,好像设置字符串是空的,即使我确实向它添加了一些字符串。 所以我无法调试我的应用程序。

非常感谢您的帮助!

请检查项目属性 window 中的 "Enable the Visual Studio hosting process" 选项。禁用此选项时,之前添加的设置字符串将为空。但是在我启用此选项后,设置字符串值将显示。

BIG 感谢@Wendy - MSFT,感谢 him/her/it 我找到了这个问题的真正解决方案(这基本上与 she/he/apache 建议直升机):

请注意:未选中 = 调试器将包括您添加到调试时间的user-settings。

已检查 = 调试器将忽略您添加到调试时间的user-settings。