0

I am doing a project using C# and SQL server. I am fetching the Response from Khoros API call.

We are trying to fetch the community level data and making API calls (suggested by khoros) and seeing the following issue:

response.Content.ReadAsStringAsync().Result;    // giving null pointer exception

This statement returns the following exception.

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference

Please refer to the screen shot.

Can anyone help me solve this issue?

Fildor
  • 14,510
  • 4
  • 35
  • 67
  • 2
    Hi @navyaKeerthi. Could you show a little more of your code? In particular, can we see the request that generates the response? Thanks. – swatsonpicken Sep 21 '20 at 10:22
  • While the status of the response is "200 - OK", it internally reports an error. So, you are probably not getting what you expect and therefore you cannot deserialize the expected object type. Now, for one, you should check responses for the "status" field and second, you should check your request. Maybe there's an illegal param value? – Fildor Sep 21 '20 at 11:20
  • @navyakeerthi Please try to prefer `await` over `.Result`. – Peter Csala Sep 21 '20 at 11:27

0 Answers0