我完全被一个简单的 Microsoft 错误消息弄糊涂了。
当我针对包含自定义 ConfigurationSection 的程序集运行 XSD.exe 时(该程序集又使用自定义 ConfigurationElement 和自定义 ConfigurationElementCollection 以及多个 ConfigurationProperties),我收到以下错误消息:
错误:处理“Olbert.Entity.Utils.dll”时出错。
- 反映类型“Olbert.Entity.DatabaseConnection”时出现错误。
- 您必须在 System.Configuration.ConfigurationLockCollection 上实现默认访问器,因为它继承自 ICollection。
然而,有问题的类有一个默认访问器:
public object this[int idx]
{
get { return null; }
set { }
}
我意识到上面没有做任何事情,但我不需要通过索引访问元素的属性。我只是想解决错误消息。
发生什么了?