TLDR: To fix this issue, migrate your project to use our official packages which are named NetOfficeFw and are published by netoffice account.
> This bug does not exists in the NetOfficeFw.Core v18.104.22.168 package and it is not a bug in the official NetOffice source code.
When you use packages like NetOffice.Word, NetOffice.Excel, NetOffice.Oulook and others published by netofficedotnet on NuGet.org, you will encounter error System.NullReferenceException: ‚Object reference not set to an instance of an object.‘ when using NetOffice code. (Note the missing Fw in package names.)
In Output window you will see an exception is thrown when calling NetOffice code:
Exception thrown: 'System.NullReferenceException' in NetOffice.dll Object reference not set to an instance of an object.
This exception is thrown by method
NetOffice.dll!NetOffice.Core.TryLoadAssembly(string fileName) NetOffice.dll!NetOffice.Core.Initialize(NetOffice.CacheOptions cacheOptions) NetOffice.dll!NetOffice.Core.CreateKnownObjectFromComProxy(NetOffice.COMObject caller, object comProxy, System.Type wrapperClassType) ExcelApi.dll!NetOffice.ExcelApi._Application.Workbooks.get()
There are fake packages on NuGet published by Erika LeBlanc (GitHub account erikaleblanc88, NuGet account netofficedotnet). These fake NetOffice assemblies does not work properly. That account is doing a lot of shady stuff in the https://github.com/netoffice organization (rewriting code history, deleting comments and issues, to name a few).
Because the published packages contain fake assemblies, you will encounter this exception by using NetOffice.Core v22.214.171.124.
Read more in our NetOffice Migration Guide