System.NullReferenceException for Statement of Changes in Equity report (cash basis)

When generating Statement of Changes in Equity reports, using cash basis, the following exception occurs:

System.NullReferenceException: Object reference not set to an instance of an object.
   at ManagerServer.HttpHandlers.Businesses.Business.Reports.StatementOfChangesInEquity.StatementOfChangesInEquityView.<>c.b__6_15(GeneralLedgerTransaction x) in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Businesses/Business/Reports/FinancialStatements/StatementOfChangesInEquity/StatementOfChangesInEquityView.cs:line 74
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`2.ToArray()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
   at ManagerServer.HttpHandlers.Businesses.Business.Reports.StatementOfChangesInEquity.StatementOfChangesInEquityView.GetViewModel(StatementOfChangesInEquity report) in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Businesses/Business/Reports/FinancialStatements/StatementOfChangesInEquity/StatementOfChangesInEquityView.cs:line 74
   at ManagerServer.HttpHandlers.Businesses.Business.Reports.Report2`1.GetViewModel() in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Businesses/Business/Reports/Report2.cs:line 806
   at ManagerServer.HttpHandlers.Businesses.Business.Reports.Report2.InnerGet2() in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Businesses/Business/Reports/Report2.cs:line 42
   at ManagerServer.HttpHandlers.Businesses.Business.BusinessTemplate.InnerGet() in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Businesses/Business/BusinessTemplate.cs:line 304
   at ManagerServer.HttpHandlers.Template.Get() in /Users/runner/work/Manager/Manager/ManagerServer/HttpHandlers/Template.cs:line 333
   at ManagerServer.Startup.<>c.<b__1_3>d.MoveNext() in /Users/runner/work/Manager/Manager/ManagerServer/Startup.cs:line 105
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

The exception does not occur if changing the accounting basis to Accrual, for the same period (however this is not a solution as the business uses cash basis).

However, not all accounting periods are affected, as there are three years from the start of the business (2014-15, 2015-16 and 2016-17) for which the Change of Equity report works fine in cash basis. Reports for all years from 2017 onwards produce the exception, when using cash basis, including the current financial year 2024-25.

The business has always been set up as cash basis in Manager (i.e. there was no change to the accounting method in 2017, that could have caused this). It’s also worth noting that the Change of Equity report used to work correctly for all of the affected years but at some point (unknown) the report has started triggering the exception.

Other financial statement reports (e.g. Profit and Loss, Balance Sheet) work correctly for the same periods, using cash basis, as the non-working Change of Equity reports.

It is possible that the bug has been present for a while, as the Change of Equity report isn’t something I use on a regular basis, so it could have been introduced in an earlier version of Manager or as a result of data that has been changed at some point over the past few months (e.g. deleting or editing entries) but it hasn’t been picked up until the running the reports today.

Desktop Edition
Manager version: 24.9.9.1845
OS version: MacOS Sonoma 14.6.1

(the bug occurs in the previous version of Manager I used too, 24.8.30.1831, so it’s not something new to the latest version)

Any help greatly appreciated!

Bit confused because your error message refers to ManagerServer

/Users/runner/work/Manager/Manager/ManagerServer

An Apple Desktop installation would not have a sub-folder for Manager nor the ManagerServer but the ManagerDesktop app installed.

So are you sure you downloaded the correct from https://www.manager.io/download ?

I can not replicate the issue;

Manager Desktop v24.9.9.1845
Apple M1 Pro
14.6.1 (23G93)

I can also not replicate it on an Ubuntu 20.04 TLS Server Edition Manager vv24.9.9.1845

I do not have the Apple Server edition so can not verify that.

The error’s possible causes relate to:

  • A specific GeneralLedgerTransaction or object being referenced in the report generation is null, or there’s an empty collection being passed.
  • A missing or improperly initialized data source or record in the accounting system.
  • Incorrect data input or incomplete data for generating the financial report.

In any case such errors should be looked at by @lubos and therefore put it in the bugs category.

Yes, definitely the Desktop version, installed from the latest 24.9.9.1845 dmg file, downloaded from https://www.manager.io/download but agree that it looks odd!

Did you move the M to the applications folder?

Yes, if you mean, is the Manager app running from within the Applications folder.

Something I’ve just identified is that the problem could relate to a historical change in equity entry, back in 2017, on 29th June. A bit of experimentation shows that Changes in Equity reports can be created for any date up to and including 29th June 2017 but if the report spans to the 30th June 2017, the exception occurs. That historical equity entry hasn’t been modified, since it was created in 2017, so potentially something it relates to in the database is triggering the exception in recent versions of Manager, despite it not being a problem at the time (or in any of the years since until now). My suspicion would be a change in Manager, made during the last year, that doesn’t like something about that historical data, when computing the report using cash basis. Either that or an unrelated update in the database, made over the last year, that’s somehow resulted in the integrity being broken for some, but not all, historical equity entries.

(The only other event on either the 29th or 30th June 2017 is the first billable time entry is recorded for the business on the 30th. Not sure if that could be related to the equity report but mentioning it for completeness)

This issue is confirmed as fixed in version 24.9.12.1848. Thanks @lubos!

1 Like