0

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.

Kurt Price
  • 301
  • 3
  • 12
  • `-2147024894` is `0x80070002`, which is `HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)`. So my wild and unfounded guess is that the code is trying to load `dten600.dll` dynamically, but failing to do so (or else the unmanaged code is hitting a `FILE_NOT_FOUND` deeper down the chain, due to some other missing dependency). Verify this DLL is present and in the search path. If necessary, use [`procmon`](https://technet.microsoft.com/en-us/sysinternals/processmonitor) to find the actual call resulting in `FILE_NOT_FOUND`. – Jeroen Mostert Jun 15 '17 at 18:33
  • would I need to add this dll as a reference? – Kurt Price Jun 15 '17 at 18:41
  • Almost certainly not -- it just needs to be loadable from somewhere. I'm not familiar with how dtSearch is installed or how the NuGet package finds it. – Jeroen Mostert Jun 15 '17 at 18:42
  • Thanks for the help. I will try to hunt that down then. – Kurt Price Jun 15 '17 at 18:43
  • looks like you are right. That file isn't referenced correctly or is missing. – Kurt Price Jun 15 '17 at 18:47
  • You have to register dten600.dll – Chetan Sanghani Oct 08 '17 at 08:35

0 Answers0