CS0411: Type arguments for method X cannot be taken out of use when building with TeamCity

This is a long shootout, but I have run out of my own ideas.

Recently, my TeamCity builds started spoofing this error:

File.cs (row, column): error CS0411: Type arguments for the method "System.Linq.Enumerable.Select (System.Collections.Generic.IEnumerable, System.Func) 'cannot be deduced from Using. Try to specify the type of arguments explicitly .

But there are no errors in my code (or project configuration).

It compiles just fine if I do it either using Visual Studio (2010) itself or using MSBuild, as the build agent would do. (Even on an assembly machine.)

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);  
 }

Has anyone seen anything like this before? What can cause this behavior?

+3
1

, ISet, .NET 4.0

TeamCity . VS. . Reshaper . VS . TeamCity .

+2

Source: https://habr.com/ru/post/1776667/


All Articles