NetOffice.Core v1.7.4.11: System.NullReferenceException

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 v1.7.4.11 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, you will encounter error System.NullRe­ferenceExcepti­on: ‚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.Core.TryLoadAssembly(string fileName):

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)


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 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 v1.7.4.11.

Read more in our NetOffice Migration Guide

Official Releases

You will find official releases wither on NetOffice on OSDN or at GitHub