Compilation errors specific to my version of pulled code that builds for others – dynamic fields in constructors and unable to infer types

I was tasked with working on a branch with a co-worker, but when I pulled their code, the branch would not build for me. We asked other developers to pull the code and see if their branches built, and it worked for everyone except me. One of the weird things is – there were more errors than I am currently getting, but after my co-worked pushed a commit (that didn’t touch the files in question) some of the errors went away.

I’d like to verify that I am receiving these errors inaccurately, and then get some help figuring out what I can do to resolve them.

We’re using .NET 6, but I ran into the same issues when trying to .NET 8.

The code with the compilation errors (I’ve added comments in the places where the errors appear):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>public class DisplayColumn : Column<dynamic?, object>
{
private DisplayColumn(ColumnId id, dynamic? value, object attributes)
: base(id, value, attributes) { } // One of the errors is shown here: CS1975
public static class DisplayColumnFactory
{
public static DisplayColumn Create(Guid columnId, dynamic? value, object attribute)
{
var displayColumn = new DisplayColumn(
new(columnId), // The other error is shown here: CS8754
value,
attribute);
return displayColumn;
}
}
}
public abstract class GuidBase
{
public Guid Id { get; set; }
protected GuidBase(Guid guid)
{
if (guid == Guid.Empty)
{
throw new InvalidOperationException("Id value cannot be empty!");
}
Id = guid;
}
}
public class ColumnId : GuidBase
{
public ColumnId(Guid guid) : base(guid)
{
}
}
public abstract class Column<TValue, TAttribute>
{
public ColumnId Id { get; }
public TValue Value { get; }
public TAttribute Attributes { get; }
protected Column(ColumnId id, TValue value, TAttribute attributes)
{
Id = id;
Value = value;
Attributes = attributes;
}
}
</code>
<code>public class DisplayColumn : Column<dynamic?, object> { private DisplayColumn(ColumnId id, dynamic? value, object attributes) : base(id, value, attributes) { } // One of the errors is shown here: CS1975 public static class DisplayColumnFactory { public static DisplayColumn Create(Guid columnId, dynamic? value, object attribute) { var displayColumn = new DisplayColumn( new(columnId), // The other error is shown here: CS8754 value, attribute); return displayColumn; } } } public abstract class GuidBase { public Guid Id { get; set; } protected GuidBase(Guid guid) { if (guid == Guid.Empty) { throw new InvalidOperationException("Id value cannot be empty!"); } Id = guid; } } public class ColumnId : GuidBase { public ColumnId(Guid guid) : base(guid) { } } public abstract class Column<TValue, TAttribute> { public ColumnId Id { get; } public TValue Value { get; } public TAttribute Attributes { get; } protected Column(ColumnId id, TValue value, TAttribute attributes) { Id = id; Value = value; Attributes = attributes; } } </code>
public class DisplayColumn : Column<dynamic?, object>
{
    private DisplayColumn(ColumnId id, dynamic? value, object attributes) 
        : base(id, value, attributes) { } // One of the errors is shown here: CS1975

    public static class DisplayColumnFactory
    {
        public static DisplayColumn Create(Guid columnId, dynamic? value, object attribute)
        {
            var displayColumn = new DisplayColumn(
                new(columnId), // The other error is shown here: CS8754
                value, 
                attribute);

            return displayColumn;
        }
    }
}

public abstract class GuidBase
{
    public Guid Id { get; set; }

    protected GuidBase(Guid guid)
    {
        if (guid == Guid.Empty)
        {
            throw new InvalidOperationException("Id value cannot be empty!");
        }

        Id = guid;
    }
}

public class ColumnId : GuidBase
{
    public ColumnId(Guid guid) : base(guid)
    {
    }
}

public abstract class Column<TValue, TAttribute>
{
    public ColumnId Id { get; }
    public TValue Value { get; }
    public TAttribute Attributes { get; }

    protected Column(ColumnId id, TValue value, TAttribute attributes)
    {
        Id = id;
        Value = value;
        Attributes = attributes;
    }
}

Here are the errors I’m getting:

  • This error is that it can’t pass a dynamic value from the constructor for DisplayColumn to the base Column class, despite the fact that Column takes an argument of dynamic Picture of Error
  • This error is that it can’t find infer the constructor used (Picture of Error). It infers it fine in other classes AND infers it fine in Visual Studio’s auto-complete (Visual Studio showing that it can infer the type).

I’ve tried:

  • Deleting and re-pulling the code base
  • Updating Visual Studio
  • Completely uninstalling and re-installing Visual Studio
  • Upgrading to .NET 8
  • Running dotnet build on the project without Visual Studio

But nothing gets rid of these errors. Help would be greatly appreciated.

New contributor

Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật