【问题标题】:Method Not Found Exception方法未找到异常
【发布时间】:2016-03-22 13:59:59
【问题描述】:

编辑:尝试调用父方法时遇到异常错误,这在我之前从未发生过。

我正在调用其他类中的函数以从 Microsoft.TeamFoundation.VersionControl.Client.dll 检索 ItemSet

c#中调用部分:

ItemSet itemsSet  = GetItemSet(variable1, variable2);
string stringSet = GetStringSet(variable1, variable2);

vb.net中的方法:

Public Function GetStringSet(ByVal variable1 As String, ByVal variable2 As String) As String
    Return variable1 + variable2
End Function

'下面的方法抛出异常

Public Function GetItemSet(ByVal variable1 As String, ByVal variable2 As String) As ItemSet
    Dim items As ItemSet = somelocal function to get ItemSet which works
    Return items
End Function
  1. Bin 文件夹已经是cleaned
  2. Cleanedrebuild 多次。
  3. 后来添加了String function,以检查是否使用了旧版本的dll
  4. 字符串 1 效果很好,在此 ItemSet itemsSet = GetItemSet(variable1, variable2); 未注释的情况下,我什至无法进入父方法。

任何想法为什么会发生这种情况?

【问题讨论】:

  • 注意:vb.net 中的第二个示例函数不是vb.net,而是C#...示例ItemSet items = somelocal
  • Dim itemsSet As ItemSet = GetItemSet(variable1, variable2);C# 来说是错误的...您是否对这些感到困惑?您也缺少函数名称。
  • C#?,那不是 C#,你混合了 VB.Net 和 C# 语法。如果需要,可以显示真实的、未修改的代码和 C# 翻译。
  • @Claudius 开启Option Strict...
  • @ElektroStudios 我试图解释这一点,但 OP 告诉我们要阅读它,它位于 vb。我不敢苟同...

标签: c# vb.net exception


【解决方案1】:

您没有正确声明函数请尝试以下函数

公共函数 GetStringSet(ByVal variable1 As String, ByVal variable2 As String) As String 返回变量 1 和变量 2 结束功能 公共函数 GetItemSet(ByVal variable1 As String, ByVal variable2 As String) As ItemSet Dim items As ItemSet = somelocal 函数以获取有效的 ItemSet 退换货品 结束功能

【讨论】:

  • 感谢您的注意,但它们已正确声明。
猜你喜欢
  • 2015-06-29
  • 1970-01-01
  • 2016-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多