简体   繁体   English

MonoDevelop / MonoTouch-表达式表示一个“值”,其中应有一个“方法组”-无法定位错误信息

[英]MonoDevelop/MonoTouch - Expression denotes a `value', where a `method group' was expected - Unable to locate error Info

Following the Tasky application's core, I created the business and database layers, however when trying to compile I get this error: 遵循Tasky应用程序的核心,我创建了业务和数据库层,但是在尝试编译时出现此错误:

Error CS0119: Expression denotes a 'value', where a 'method group' was expected (CS0119) (assales.core)

The problem is that there is no line number nor file reference to go along with the error as would normally would occur with a compilation error. 问题是没有行号或文件引用与错误一起发生,而编译错误通常会发生该错误。 This makes me assume that perhaps there is an issue with the project options, but that's just a guess and there are many options. 这使我假设项目选项可能存在问题,但这只是一个猜测,并且有很多选项。 What specifically do I need to do to either locate the error or get more information on this error. 我需要专门做什么来查找错误或获取有关此错误的更多信息。

The full build output: 完整的构建输出:

Building: assales.core (Debug)
Performing main compilation...
/Library/Frameworks/Mono.framework/Versions/2.10.12/bin/dmcs /noconfig "/out:/Users/sb/assales/assales.core/bin/Debug/assales.core.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/System.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/System.Data.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/Mono.Data.Sqlite.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/System.Data.Linq.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/System.Xml.Linq.dll" "/r:/Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG"  /t:library "/Users/sb/assales/assales.core/AssemblyInfo.cs" "/Users/sb/assales/assales.core/DL/SqlLite.cs" "/Users/sb/assales/assales.core/DL/AlcSalesDatabase.cs" "/Users/sb/assales/assales.core/BusinessLayer/Contracts/BusinessEntityBase.cs" "/Users/sb/assales/assales.core/BusinessLayer/Contracts/IBusinessEntity.cs" "/Users/sb/assales/assales.core/BusinessLayer/Location.cs" "/Users/sb/assales/assales.core/BusinessLayer/Managers/LocationManager.cs" "/Users/sb/assales/assales.core/DAL/LocationRepository.cs" 
Compilation failed: 1 error(s), 0 warnings

error CS0119: Expression denotes a `value', where a `method group' was expected


Build complete -- 1 error, 0 warnings

---------------------- Done ----------------------

Build: 1 error, 0 warnings

I think it's a problem of the mono compiler. 我认为这是单声道编译器的问题。 If I omit the "new" keyword in a statement that uses var: 如果我在使用var的语句中省略了“ new”关键字:

// "var" version
public class App {
   public static void Main() {
      //missing keyword "new"
      var bitArray = System.Collections.BitArray(); 
   }
}

the compiler does not indicate row number either file name: 编译器均未指定行号或文件名:

$ mcs App.cs
error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected

If instead I declare explicitly bitArray (without using "var"): 相反,如果我明确声明了bitArray(不使用“ var”):

public class App {
   public static void Main() {
      //missing keyword "new"
      System.Collections.BitArray bitArray = System.Collections.BitArray(); 
   }
}

the compiler works well: 编译器运行良好:

$ mcs App.cs
App.cs(3,27): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
was expected

My mcs version is: 我的mcs版本是:

$mcs --version
Mono C# compiler version 3.2.3.0

By the way, the Microsoft compiler works well also with "var version" of App.cs 顺便说一下,Microsoft编译器也可以与App.cs的“ var版本”一起很好地工作

/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v4.0.30319/csc.exe App.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.

App.cs(4,23): error CS0119: 'System.Collections.BitArray' is a 'type', which is not valid in the given context

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM