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.

C#
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.
10,838 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,849 questions
0 comments No comments
{count} votes

Your answer

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