Welcome to OGeek Q&A 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 reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...