Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Object reference not set to an instance of an object.

Started by Tony Carter -   in API Endpoints

Hi,

I am trying to get Balance Sheet report in my web app:
public async Task Insert_BalanceSheet(some parameters)
{
...
try
{
Xero.NetStandard.OAuth2.Model.Accounting.ReportWithRows pal = await apiInstance.GetReportBalanceSheetAsync(accessToken, xeroTenantId, startDate, 1, timeFrame, null, null, true, false);
...
}
catch (Exception e)
{
...
Console.WriteLine(e.ToString());
}
...
}
and get an error:
"Object reference not set to an instance of an object."
It crashes not letting me to even catch the exception on this line:
Xero.NetStandard.OAuth2.Model.Accounting.ReportWithRows pal = await apiInstance.GetReportBalanceSheetAsync(accessToken, xeroTenantId, startDate, 1, timeFrame, null, null, true, false);

The same code works fine in my console app.

Any ideas?
Please can you contact us using this link contact support and provide the name of your API application and the Client ID.
If possible, include the timestamp and timezone of the call
 

Sally C (Community Manager)  

Hi, just submitted the form. Thanks.
 

Tony Carter  

Submitted another form with approximate time of the call.
 

Tony Carter