yohney / dto-generator

A visual studio plugin for generating DTO objects from entities
MIT License
65 stars 26 forks source link

Error trying to generate dto from EF class in VS 2017 #11

Open vsdotnetguy opened 7 years ago

vsdotnetguy commented 7 years ago

Object reference not set to an instance of an object.

at Microsoft.CodeAnalysis.SolutionParser.<>cDisplayClass1_0.b2(Document p) at System.Linq.Enumerable.<>cDisplayClass6_0`1.b0(TSource x) at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at Microsoft.CodeAnalysis.SolutionParser.GetDocumentByLocation(Solution solution, SolutionLocation location, String documentName) at DtoGenerator.Vsix.GenerateDtoCommand.d__13.MoveNext() in F:\git\dto-generator\src\DtoGenerator\DtoGenerator.Vsix\GenerateDtoCommand.cs:line 220

Below is EF class we're trying to generate DTO for:

namespace WebAPI.Data { using System; using System.Collections.Generic;

public partial class invoice
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
    public invoice()
    {
        this.invoice_transaction = new HashSet<invoice_transaction>();
    }

    public string id { get; set; }
    public string invoice_batch_id { get; set; }
    public string account_id_debtor { get; set; }
    public string account_id_owner { get; set; }
    public string driver_id { get; set; }
    public string invoice_number { get; set; }
    public Nullable<decimal> balance { get; set; }
    public string load_number { get; set; }
    public Nullable<decimal> amount { get; set; }
    public string equipment_type { get; set; }
    public Nullable<System.DateTime> datetime_purchased { get; set; }
    public Nullable<System.DateTime> datetime_closed { get; set; }
    public Nullable<System.DateTime> datetime_paid { get; set; }
    public string pickup_address { get; set; }
    public string pickup_city { get; set; }
    public string pickup_county { get; set; }
    public string pickup_state { get; set; }
    public string pickup_zip { get; set; }
    public string pickup_country { get; set; }
    public Nullable<decimal> pickup_lat { get; set; }
    public Nullable<decimal> pickup_lng { get; set; }
    public string pickup_formatted_address { get; set; }
    public string delivery_address { get; set; }
    public string delivery_city { get; set; }
    public string delivery_county { get; set; }
    public string delivery_state { get; set; }
    public string delivery_zip { get; set; }
    public string delivery_country { get; set; }
    public Nullable<decimal> delivery_lat { get; set; }
    public Nullable<decimal> delivery_lng { get; set; }
    public string delivery_formatted_address { get; set; }
    public string distance_formatted { get; set; }
    public string duration_formatted { get; set; }
    public Nullable<int> distance { get; set; }
    public Nullable<int> duration { get; set; }
    public Nullable<System.DateTime> datetime_delivery { get; set; }
    public Nullable<decimal> linehaul_amount { get; set; }
    public Nullable<decimal> less_advances_amount { get; set; }
    public Nullable<decimal> detention_amount { get; set; }
    public Nullable<decimal> lumper_paid_amount { get; set; }
    public string paid_by_entity { get; set; }
    public System.DateTime datetime_created { get; set; }

    public virtual account account { get; set; }
    public virtual account account1 { get; set; }
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
    public virtual ICollection<invoice_transaction> invoice_transaction { get; set; }
}

}

rosoft2001 commented 5 years ago

Same error today:

at Microsoft.CodeAnalysis.SolutionParser.<>cDisplayClass1_0.b2(Document p) at System.Linq.Enumerable.<>cDisplayClass6_0`1.b0(TSource x) at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at Microsoft.CodeAnalysis.SolutionParser.GetDocumentByLocation(Solution solution, SolutionLocation location, String documentName) at DtoGenerator.Vsix.GenerateDtoCommand.d__13.MoveNext() in F:\git\dto-generator\src\DtoGenerator\DtoGenerator.Vsix\GenerateDtoCommand.cs:line 220