Getting NaN in our data and its killing our C# code, but returns in Kibana?

Good Day,

Maybe you can help me with this.
We have data being indexed into our system and appartantly there are times when there are sections of data that are not just there and may not be populated at certain times of day. The index goes in fine and we can query the data but when running aggs, it appears that at certain times we have a field that comes back as NaN??? in Kiabana, we get results, but in C# if we make the same query, it errors out and doesn't come back at all. Is there a way around this, such as if theres a NaN, the C# code will still result will still return instead of just killing the call. It appears that in C# the .Percentiles() function is what blows up. Is there any gotchas that you all may know about this function to get it to perform properly?