This is a long shoot but I have run out of own ideas.
Recently my TeamCity builds have started to throw this error upon me:
File.cs(Row, Col): error CS0411: The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
But there ar开发者_Go百科e no errors in my code (or project configuration).
It compiles just fine if I do it either from withing Visual Studio (2010) itself or using MSBuild just as the build agent would do. (Even on the build machine.)
Just for reference, the code looks something like this:
public ISet<Task> Tasks {get; set;}
public IEnumerable<GradedTask> FindGradedTasks(){
return Tasks.Select(GetResult).Where(t=>t.HasResult).ToList(); // error
}
public GradedTask GetResult(Task task) {
return new GradedTask(this, task);
}
Anyone seen anything like this before? What might be causing this behaviour?
Seems like you are using ISet interface but it is defined only in .NET 4.0
TeamCity is absolutely right. It is VS bug. We are has been beaten by this. Accidentally Reshaper introduce Optional argument. And VS compiles this just fine. But TeamCity is not.
精彩评论