Page 1 of 1

License error

PostPosted: Nov 07, 2017 18:10
by ecaptein
I have the following error:


The type initializer of "Neurotec.Licensing.NLicense"
threw an exception. in Neurotec.Licensing.NLicense.ObtainComponents(String address, Int32 port, String components)


Part of code:

if (!NLicense.ObtainComponents("/local", 5000, components))
{
throw new ApplicationException(string.Format("Could not obtain licenses for components: {0}", components));
}
if (NLicense.ObtainComponents("/local", 5000, AdditionalComponents))
{
components += "," + AdditionalComponents;
}

Re: License error

PostPosted: Nov 08, 2017 16:10
by MartynasV
ecaptein wrote:I have the following error:


The type initializer of "Neurotec.Licensing.NLicense"
threw an exception. in Neurotec.Licensing.NLicense.ObtainComponents(String address, Int32 port, String components)


Part of code:

if (!NLicense.ObtainComponents("/local", 5000, components))
{
throw new ApplicationException(string.Format("Could not obtain licenses for components: {0}", components));
}
if (NLicense.ObtainComponents("/local", 5000, AdditionalComponents))
{
components += "," + AdditionalComponents;
}

Hello ecaptein,

Check the InnerException property of the TypeInitializationException, it is likely to contain information about the underlying problem. But I'm guessing that your program doesn't find native libraries(.dll) from "SDK/Bin/Win*" directory:

.Net dlls from the SDK depends on the native dlls in the SDK, i.e. Neurotec.dll depends on the NCore.dll. Your received error means that your application can not find the native dll.
There are two solutions for this issue. First one, the fastest and easiest one, is to copy all dlls from the SDK to the output folder of your application.
The second way is to add the path to SDK dlls into System environmental variable PATH and restart the computer.