在 C# 应用程序中,客户端出现以下错误
The property 'PlayLists' could not be created from it's default value. Error message: Could not load file or assembly '0 bytes loaded from System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. An attempt was made to load a program with an incorrect format.
PlayLists 是 StringCollection 类型的设置
设置中的默认值是
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>test</string>
</ArrayOfString>
我得到的堆栈跟踪是
at System.Configuration.SettingsPropertyValue.Deserialize()
at System.Configuration.SettingsPropertyValue.get_PropertyValue()
at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
at Sync.Properties.Settings.get_PlayLists()
at Sync.FormMain.selectLastSycLists()
at Sync.FormMain..ctor()
at Sync.Program.Main()
我的代码中启动这一切的方法如下所示。
private void selectLastSycLists()
{
// Accessing PlayLists caused it
foreach(String settingsPList in Properties.Settings.Default.PlayLists)
{
...
}
}
我不太确定是什么原因造成的,任何建议都会很棒