This project is read-only.

Error Cannot be empty Parameter name. knownInstances

Mar 16, 2012 at 5:46 PM
Edited Mar 16, 2012 at 5:47 PM


I am in the process of implementing your tool as a plugin in Microsoft Dynamics CRM.
I have to use .Net 3.5 and i had to recompile the assemblies with strong names to be able to deploy them in Dynamics CRM.
As an Windows Forms Application it works as a charm.

But as an plugin i get the errormessage

exception :Cannot be empty
Parameter name: knownInstances

The code where it crashes is this:

var foundLanguages = LanguageIdentifier.ClassifyText(strDescription, strLanguageFolder,_intMaxNumberofChars,null

Any suggestion what this can be?
I have traced the message to IvanAkcheurov.NClassify  KnnMonoCategorizedClassifier.

Greethings Michael

Mar 18, 2012 at 7:33 PM

Hi Fauler,

Thank you for reporting a problem.

This problem is most probably caused by strLanguageFolder parameter which should point (relative or absolute) to folder with language models.
It doesn't examine subfolders recursively, it means that language models have to be immediate children of the folder strLanguageFolder points to.
Most probable causes:

  1. You might have used default value of languageModelsDirectory parameter which is a path relative to NTextCat's folder (where binaries have been extracted). Current Directory of Microsoft Dynamics CRM probably is not NTextCat's folder. 
    In this case, you can specify absolute path to the folder with language models. 
  2. You might just have specified wrong path (e.g. typo or folder that doesn't contain language models as immediate children).

I have created an issue regarding proper error reporting if no language models have been found:

Thank you very much for reporting and please write us whether you have solved your problem or not.

P.S. We would appreciate very much if you contribute your plugin code for Microsoft Dynamics CRM (we'd grant you developer permissions). Then we can maintain and extend this plugin with future features and API changes. Or at least please describe how you did that (as a small article in Documentation section).

P.S.S. SQL-CLR integration is almost finished so you'll be able to use NTextCat in SQL Server. Side effect of this is all assemblies got signed (to be released as v0.1.7).

Marked as answer by IvanAkcheurov on 1/7/2014 at 3:51 PM
Mar 19, 2012 at 11:58 AM

Hi Ivan,

thank you!!! Number 2 was the error. Now it works. Stupid little error.

I can contribute the code no problem.
What it does it extracts the body of an email does some basic html stripping and then tries to get the language of incoming email. 
Searches then the iso code in a crm based entity list of languages and afterwards sets the corresponding language as an lookup at the email.
The LanguageFolder and the MaxNumber of Chars is configurable during Pluginregistration.

Thank you again!

Greets Michael.

P.S. BTW can you give me some more insight about the number or the list of languages i get as an response of your tool.
Is the order of the tuple representing the highest likeability of the found lanuages? And or does an higher number means that this is probably the correct language or is the opposite true?