Page 1 of 1

NLicense not load

PostPosted: May 24, 2017 12:37
by i4nnet
anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"

Re: NLicense not load

PostPosted: May 25, 2017 06:43
by vaidasz
i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

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

Re: NLicense not load

PostPosted: Jun 02, 2017 06:33
by i4nnet
vaidasz wrote:
i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

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



Dear sirs, for your information, i have tried the two solutions you sugested to me, but it didn"t work out. Is there any alternative to solve this problem?

Re: NLicense not load

PostPosted: Jun 02, 2017 12:56
by MartynasV
i4nnet wrote:
vaidasz wrote:
i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

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



Dear sirs, for your information, i have tried the two solutions you sugested to me, but it didn"t work out. Is there any alternative to solve this problem?

Hello,

No. You have to provide library (.dll) files for your program. Just copy all dlls from "SDK\Bin\Win32_x86 or Win64_x64 " to your program's working directory.

Re: NLicense not load

PostPosted: Nov 07, 2017 18:52
by Dilson
I found the error below already did the above process and it did not work.


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

Below part of code:

string retorno = "";
int score = -1;

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

using (var biometricClient = new NBiometricClient())
// Create subjects with face object
using (NSubject referenceSubject = CreateSubject(args[0], args[0]))
using (NSubject candidateSubject = CreateSubject(args[1], args[1]))
{
// Set matching threshold
biometricClient.MatchingThreshold = 48;

// Set matching speed
biometricClient.FacesMatchingSpeed = NMatchingSpeed.Low;

// Verify subjects
NBiometricStatus status = biometricClient.Verify(referenceSubject, candidateSubject);
if (status == NBiometricStatus.Ok || status == NBiometricStatus.MatchNotFound)
{
score = referenceSubject.MatchingResults[0].Score;
//Console.Write("image scored {0}, verification.. ", score);
//Console.WriteLine(status == NBiometricStatus.Ok ? "succeeded" : "failed");
}
else
{
//Console.Write("Verification failed. Status: {0}", status);
return -1;
}
}
}
catch (Exception ex)
{
//retorno = ex.Message;
retorno = ex.Message + ex.StackTrace;
//return TutorialUtils.PrintException(ex);
return -1;
}

return score;

Re: NLicense not load

PostPosted: Nov 08, 2017 16:35
by MartynasV
Dilson wrote:I found the error below already did the above process and it did not work.


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

Below part of code:

string retorno = "";
int score = -1;

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

using (var biometricClient = new NBiometricClient())
// Create subjects with face object
using (NSubject referenceSubject = CreateSubject(args[0], args[0]))
using (NSubject candidateSubject = CreateSubject(args[1], args[1]))
{
// Set matching threshold
biometricClient.MatchingThreshold = 48;

// Set matching speed
biometricClient.FacesMatchingSpeed = NMatchingSpeed.Low;

// Verify subjects
NBiometricStatus status = biometricClient.Verify(referenceSubject, candidateSubject);
if (status == NBiometricStatus.Ok || status == NBiometricStatus.MatchNotFound)
{
score = referenceSubject.MatchingResults[0].Score;
//Console.Write("image scored {0}, verification.. ", score);
//Console.WriteLine(status == NBiometricStatus.Ok ? "succeeded" : "failed");
}
else
{
//Console.Write("Verification failed. Status: {0}", status);
return -1;
}
}
}
catch (Exception ex)
{
//retorno = ex.Message;
retorno = ex.Message + ex.StackTrace;
//return TutorialUtils.PrintException(ex);
return -1;
}

return score;

Hello Dilson,

Check the InnerException property of the TypeInitializationException, it is likely to contain information about the underlying problem.

Re: NLicense not load

PostPosted: Nov 08, 2017 17:45
by Dilson
Hi,

Follows the result of the InnerException:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
em Neurotec.Licensing.NLicense.NLicenseTypeOf(HNObject& hValue)
em Neurotec.NTypeReg..ctor(GetObjectPlain typeOf, Type type)
em Neurotec.NTypeMap.Add(GetObjectPlain typeOf, Type type, Type[] relatedTypes)
em Neurotec.Licensing.NLicense..cctor()

Re: NLicense not load

PostPosted: Nov 09, 2017 08:54
by MartynasV
Dilson wrote:Hi,

Follows the result of the InnerException:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
em Neurotec.Licensing.NLicense.NLicenseTypeOf(HNObject& hValue)
em Neurotec.NTypeReg..ctor(GetObjectPlain typeOf, Type type)
em Neurotec.NTypeMap.Add(GetObjectPlain typeOf, Type type, Type[] relatedTypes)
em Neurotec.Licensing.NLicense..cctor()

Hello Dilson,

Error “An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" is thrown, when the application is trying to load incorrect dlls. i.e. if your application is compiled with configuration “win64_x64” and the application is loading 32 bit dlls.
Or i.e. you have compiled the application with “AnyCPU” configuration and you are running the application on 64 bit OS and the application is loading 32 bit dlls.
Please check what configuration is used to build your application and if the correct dlls are loaded.

Re: NLicense not load

PostPosted: Nov 13, 2017 12:17
by Dilson
I have tested all the options that can not make it work.
I changed from AnyCPU to run in 32 bits put the dlls of my SDK Neurotec_Biometric_10_0_SDK_Trial\Bin\Win32_x86 did not work.
I also tested this way:
NLicense.Add ("Biometrics.FaceDetection");
NLicense.Add ("Biometrics.FaceExtraction");
NLicense.Add ("Biometrics.FaceSegmentsDetection");
But the error persists.

Re: NLicense not load

PostPosted: Nov 13, 2017 12:51
by MartynasV
Dilson wrote:I have tested all the options that can not make it work.
I changed from AnyCPU to run in 32 bits put the dlls of my SDK Neurotec_Biometric_10_0_SDK_Trial\Bin\Win32_x86 did not work.
I also tested this way:
NLicense.Add ("Biometrics.FaceDetection");
NLicense.Add ("Biometrics.FaceExtraction");
NLicense.Add ("Biometrics.FaceSegmentsDetection");
But the error persists.

Hello Dilson,

This is dll issue, not licensing.
Please write to support@neurotechnology.com with issue description.

P.S. You are using NLicense.Add() method incorectly, you have to read license file(.lic) as text and then add that text(string) using that method (after license is added you can obtain it).

Re: NLicense not load

PostPosted: Nov 14, 2017 15:05
by Dilson
Hi,

I sent the email as requested.

Thank you!