Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Others[杂七杂八] by (120 points)

Solution to Value cannot be null. (Parameter 'source') Error in production

I  got the following error in production Value cannot be null. (Parameter 'source')

My enum values are

public enum Offer{
  
    None=1,
    all,
    stop,
   
}
Class Emp{
   [Column(TypeName = "jsonb")]
   public list<Offer> offer { get; set; }

    public D d { get; set }

  public string FullName { get; set }

}

class D
{
   
   public string age { get; set }

   public string countryCode { get; set }

} 
public async Task<List<Emp>> ListEmp( List<Offer> offer ){
var query= catalogDb.Emp.Include(a=>a.D) .Where(a=>a.Name="xyz") .AsQueryable();
}
if(offer.Count>0){

                var result=query.AsEnumerable()
                                .Where(y => y.Offers.Any(z => offer.Contains(z)))
                                .ToList();
                return result;
            }
return await query.ToListAsync();
}
when I run  dotnet publish and   dotnet publish -c Release -o out then i run  dotnet out/Emp.dll
then i got 
   Unhandled exception. System.ArgumentNullException: String reference not set to an instance of a String. (Parameter 's')
   at System.Text.Encoding.GetBytes(String s)
could you pleas help me to solved this
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...