Skip to content

LoadFromTextFile invalid model throw NullReferenceException #3051

@MaximRouiller

Description

@MaximRouiller

System information

.NET Core SDK (reflecting any global.json):
Version: 2.2.104
Commit: 73f036d4ac

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.104\

Issue

  • What did you do?
    Tried to load a model from this Kaggle. My model definition skipped a column index.

  • What happened?

NullReferenceException

  • What did you expect?

A user-friendly error message.

Source code / logs

public class KingCountyHouseData
{
        [LoadColumn(0)]
        public string Id { get; set; }

        [LoadColumn(1)]
        public string SaleDate { get; set; }
        public float Price { get; set; } // <== this was missed

        [LoadColumn(2)]  // <=== this should be +1
        public float Bedrooms { get; set; }

        [LoadColumn(3)]  // <=== this should be +1
        public float Bathrooms { get; set; }

        [LoadColumn(4)]  // <=== this should be +1
        public float LivingAreaSquareFoot { get; set; }

        [LoadColumn(5)]  // <=== this should be +1
        public float Floors { get; set; }

        [LoadColumn(6)]  // <=== this should be +1
        public bool Waterfront { get; set; }

        //.... more fields below.
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingusabilitySmoothing user interaction or experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions