Share via

Microsoft.Office.Tools.ListObjectAdapter - System.NullReferenceException

Vojtěch Habrnal | UNIWISE 0 Reputation points
2024-08-22T08:38:54.7333333+00:00

Hi there,

I am a developer that works with a legacy Excel Extension codebase. Now we are populating a few tables using Microsoft.Office.Tools.Excel. Currently I am experiencing a System.NullReferenceException in Microsoft.Office.Tools.Excel.ListObjectAdapter (as shown in the picture below).
User's image

private readonly ApplicationFactory factory;
private async Task ProcessSetting(WorkBookListOFvalues item, Stopwatch s, long time, StringBuilder print)
{
    ListObject tableLo = null;
    DataSet ds = null;
    DataTable data = null;

    try
    {
        try
        {
            globals.Dispatcher.Invoke(() =>
            {
                tableLo = factory.GetVstoObject(ExcelExtensions.GetListObject(TargettyFormLoadAndSave.Action.applicationSettings.Workbook, item.ListObject));
            });
        }
        catch (Exception e)
        {
			// Error handling
            return;
        }

Troubleshooting methods used:
A colleague of mine suggested to check if I am correctly logged into a Visual Studio and Excel (I am). Since the problem seems to be inside a official library I have tried to read documentation with no success so far.

Any help is appreciated.

Microsoft 365 and Office | Development | Other
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.