繁体   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