C# DTSearch TypeInitializationException In Options

355 Views Asked by At

I have a legacy C# project that uses dtsearch with the dtSearchNetApi2 NuGet Package. I am currently using VS 2015 with .NET 4.5 target. When I attempt to make a dtSearch.Engine.Options object I get a TypeInitializationException. I have tried a few things and changed my code to find out where the issue is really coming from.

Orignal:

_dtSearchOptions = new Options{ FieldFlags = FieldFlags.dtsoFfSkipDocumentProperties |
                                                       FieldFlags.dtsoFfSkipFilenameFieldPath |
                                                       FieldFlags.dtsoFfSkipFilenameField};

I thought maybe there was a problem with the FieldFlags, so I removed them and everything else to just make a normal Options object.

_dtSearchOptions = new Options();

But this also gives me the TypeInitializationException. The inner exception for this says that the exception comes from LoadEngine() with the following exact message

InnerException: 
   HResult=-2147024894
   Message=dten600.dll
   Source=dtSearchNetApi2
   StackTrace:
        at LoadEngine()
        at ApiInitializer..ctor()
        at ApiInitializer..cctor()

Any ideas of what is going wrong here? This is legacy code and is currently being used, so I believe this must have to do with my VS or setup and not the code itself.

0

There are 0 best solutions below