运行程序解析setting的字段出现问题,报CS1056 \CS1040\CS0116

yexinzi 2018-10-12 11:07:09
自编软件启动时报错:

The property 'CultureConfig' could not be created from it's default value. Error message: Unable to generate a temporary class (result=1).\r\nerror CS1056: Unexpected character ''\r\nerror CS1040: Preprocessor directives must appear as the first non-whitespace character on a line\r\nerror CS0116: A namespace cannot directly contain members such as fields or methods\r\n\r\n at System.Configuration.SettingsPropertyValue.Deserialize()\r\n at System.Configuration.SettingsPropertyValue.get_PropertyValue()\r\n at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)\r\n at System.Configuration.SettingsBase.get_Item(String propertyName)\r\n at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)\r\n at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)\r\n at NcStudio.Properties.Settings.get_CultureConfig()\r\n at NcStudio.Program.Main(String[] args)
592 Error 10/11/2018 9:42:43 PM Event o.main.error The property 'CultureConfig' could not be created from it's default value. Error message: Unable to generate a temporary class (result=1).\r\nerror CS1056: Unexpected character ''\r\nerror CS1040: Preprocessor directives must appear as the first non-whitespace character on a line\r\nerror CS0116: A namespace cannot directly contain members such as fields or methods\r\n\r\n at System.Configuration.SettingsPropertyValue.Deserialize()\r\n at System.Configuration.SettingsPropertyValue.get_PropertyValue()\r\n at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)\r\n at System.Configuration.SettingsBase.get_Item(String propertyName)\r\n at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)\r\n at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)\r\n at NcStudio.Properties.Settings.get_CultureConfig()\r\n at NcStudio.Program.Main(String[] args)
593 Error 10/11/2018 9:42:43 PM Event p.start.error The property 'CultureConfig' could not be created from it's default value. Error message: Unable to generate a temporary class (result=1).\r\nerror CS1056: Unexpected character ''\r\nerror CS1040: Preprocessor directives must appear as the first non-whitespace character on a line\r\nerror CS0116: A namespace cannot directly contain members such as fields or methods\r\n


以上报错感觉和此处有关,但不知道如何查证
<setting name="CultureConfig" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>zh-CN</string>
<string>en-US</string>
<string>ko-KR</string>
</ArrayOfString>
</value>
</setting>

求助
...全文
338 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
stherix 2018-10-12
  • 打赏
  • 举报
回复
配置文件里有非法字符 很可能是UTF8 BOM引起的问题 讲配置文件打开再用UTF8无BOM保存试试

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧