I am developing a plug-in for a third-party application which requires to use a System.LicenseProvider.
The License File itself is FlexLM generated.
so I have:
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyLicensedModule
{
protected System.ComponentModel.License thisLicense;
protected ModuleFlexFeature thisfeature;
public bool LicenseCheck()
{
bool isLicensed = LicenseManager.IsLicensed(typeof(ModuleFlexFeature)); //returns TRUE
if(thisFeature==null) thisFeature = new ModuleFlexFeature();
thisLicense = LicenseManager.Validate(typeof(ModuleFlexFeature),thisFeature);
//no thrown exception
return (thisLicense != null); //thisLicense is always null
}
public void Dispose()
{
if (thisLicense!=null)
{
thisLicense.Dispose();
thisLicense = null;
}
}
}
(+ other irrelevant methods), using:
internal class ModuleFlexFeature
{
public ModuleFlexFeature() { }
public string FeatureName { get { return "myFlexLMFeature"; } }
public float FeatureVersion { get { return 2016.0f; } }
}
Using the LMTOOLS by Flexera, I can get the License Server Status (I am running on 7507@mypcname, 0 out of 1 license for myFlexLMFeature is used).
Then I can add 7507@mypcname in the extra servers to be used by the third party app, but:
- isLicensed returns true (expected)
- LicenseManager.Validate() does not throw exception (expected)
- thisLicense is null (not expected)
I've tried to use
LicenseManager.IsValid(typeof(ModuleFlexFeature),new ModuleFlexFeature(), out thisLicense);
but both have similar results (code seems to work but thisLicense is null)
Am I doing anything wrong ? is LicenseManager compatible with FlexLM ? or is there a bug on the third-party app which runs my plug-in (somehow does not connect to the license server properly)? How to check?
Thanks