简体   繁体   English

MissingMethodException:找不到方法

[英]MissingMethodException: Method not found

Just not able to understand why I am getting this error. 只是不明白为什么我会收到此错误。 I have code and trying to implement indexer: 我有代码并尝试实现索引器:

public class BOCollection<TKey, TValue>
{
    IDictionary<TKey, TValue> _privateDictionary = new Dictionary<TKey, TValue>();
    public TValue this[TKey key]
   {
        get{return _privateDictionary[key];}
        set{_privateDictionary[key] = value;}
    }

//Dictionary Methods
//Other methods
}

There is no compile time error, but getting run time error: 没有编译时错误,但出现运行时错误:

Method not found: 'System.Collections.Generic.Dictionary`2 NGC.BO.Base.BOBaseClass.get_Child()'. 找不到方法:“ System.Collections.Generic.Dictionary`2 NGC.BO.Base.BOBaseClass.get_Child()”。

在此处输入图片说明

Your indexer is fine. 您的索引器很好。 Seems that your collection have some object(s) that are missing required implementation of Child property. 似乎您的集合中有一些对象缺少Child属性的必需实现。

So another solution to this could be, because I experienced this. 因此,对此的另一种解决方案可能是,因为我经历了这种情况。 I have a project depending on a few other projects. 我有一个项目取决于其他几个项目。 The main project also had reference to one of the other projects - how ever - it did not use it. 主项目还引用了其他项目之一-但是-没有使用它。

So when I deleted the reference in the main object, the problem disappeared. 因此,当我删除主要对象中的引用时,问题消失了。 I have a feeling the reason is that the main object is built last and therefor it overwrites the newly built otherproject.dll with it's own otherproject.dll ... because it is not being used. 我有一种感觉,原因是主对象是最后构建的,因此它用自己的otherproject.dll覆盖了新构建的otherproject.dll ...因为未使用它。

So my suggestion is: Go over your references and check if it is being used in the project or not. 因此,我的建议是:查阅您的参考文献,检查它是否正在项目中使用。 If it isn't - remove it all together. 如果不是,请全部删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.MissingMethodException:找不到方法? - System.MissingMethodException: Method not found? System.MissingMethodException:找不到 Bigquery 的方法 - System.MissingMethodException: Method not found for Bigquery 运行到System.MissingMethodException:使用PrivateObject找不到方法 - Running into System.MissingMethodException: Method Not Found with PrivateObject 找不到System.MissingMethodException方法Crystal报表 - System.MissingMethodException Method Not Found Crystal Reports dll 中的方法抛出 System.MissingMethodException:找不到方法 - Method in dll throwing System.MissingMethodException: Method not found System.MissingMethodException: &#39;找不到 XmlRpcProxyGen.Create 的方法 - System.MissingMethodException: 'Method not found for XmlRpcProxyGen.Create 动态调用者给出错误 MissingMethodException: Method &#39;Clock.TEST&#39; not found - Dynamic caller give error MissingMethodException: Method 'Clock.TEST' not found C#UnitTest异步方法错误 - System.MissingMethodException:找不到方法: - C# UnitTest Async Method Error - System.MissingMethodException: Method not found: System.MissingMethodException:找不到方法:“?” 尝试使用委托方法构建自定义动态类型时 - System.MissingMethodException: Method not found: '?' when trying to build a custom dynamic type with a delegate method ASP.NET vNext - MissingMethodException:找不到方法:Microsoft.CodeAnalysis.Diagnostic> EmitResult.get_Diagnostics()' - ASP.NET vNext - MissingMethodException: Method not found: Microsoft.CodeAnalysis.Diagnostic> EmitResult.get_Diagnostics()'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM