【问题标题】:linq to object - Method not foundlinq to object - 找不到方法
【发布时间】:2011-05-08 07:58:10
【问题描述】:

我正在尝试使用简单的 LINQ to Objects 查询。

当我尝试运行我的应用程序时,我收到以下消息:

System.InvalidOperationException was unhandled
  Message="An error occurred creating the form. See Exception.InnerException for details.  The error is: Method not found: 'Void sharatTashlumimWS.paymentDetailsManager.set_ReleaseDate(System.DateTime)'."
  Source="WindowsApplication1"
  StackTrace:
       at WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
       at WindowsApplication1.My.MyProject.MyForms.get_Form1()
       at WindowsApplication1.My.MyApplication.OnCreateMainForm() in C:\MmiSources\Ksafim\APPLICATIONS\TashlumZikuy\Tashlumim\sharatTashlumimWS\WindowsApplication1\My Project\Application.Designer.vb:line 35
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.MissingMethodException
       Message="Method not found: 'Void sharatTashlumimWS.paymentDetailsManager.set_ReleaseDate(System.DateTime)'."
       Source="WindowsApplication1"
       StackTrace:
            at WindowsApplication1.Form1..ctor()
       InnerException: 

如果我把这段代码放在一个 ASP 应用程序中,它运行良好。

我的 linq 语句是:

Dim query = From m In movies Select m

【问题讨论】:

    标签: asp.net vb.net linq exception


    【解决方案1】:

    查看 InnerException

    InnerException: System.MissingMethodException
           Message="Method not found: 'Void sharatTashlumimWS.paymentDetailsManager.set_ReleaseDate(System.DateTime)'."
           Source="WindowsApplication1"
           StackTrace:
                at WindowsApplication1.Form1..ctor()
           InnerException:
    

    【讨论】:

    • +1。你有Option Strict On吗?如果没有,请打开它:然后我怀疑编译器可能会为您识别问题。
    【解决方案2】:

    根据给出的例外情况,它似乎从来没有到达您的查询 - 设置 Form1 时出现问题,可能是在构建电影表时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-08
      • 1970-01-01
      • 1970-01-01
      • 2015-08-25
      • 1970-01-01
      相关资源
      最近更新 更多