I have a database management class which has multiple methods to reach different endpoints on a REST API. Everything appears to be working except for this one issue. When the app is started, I am trying to reach an endpoint the exact same way I reach the other endpoints. For some reason, this one completely breaks the app and throws a NullReferenceException without any information.
I have confirmed that the client is not null, and the URL and endpoint works fine in Postman. I honestly have no idea what would be causing this exception, and the fact that it doesn't show any information about the exception just makes it worse.
private async void InitDatabase()
{
HttpResponseMessage response = await client.GetAsync("System?Guid=1");
string responseString = await response.Content.ReadAsStringAsync();
SysParams sysParams = JsonConvert.DeserializeObject<SysParams>(responseString);
}
The error occurs when the first line is executed where client.GetAsync is called.