GetProductKey does not work

Hello,
I have a problem with the GetProductKey function, it does not work and it crashes the application, Here is the code that calls this function:
var key = levelValue = new StringBuilder();
var status = LexActivator.GetProductKey(key, 255);

thanks in advance.

The code is :
var status = LexActivator.IsProductGenuine();
if(status == LexActivator.LA_OK || status == LexActivator.LA_GP_OVER)
{
var extraActivationData = new StringBuilder();
var key = new StringBuilder();
status = LexActivator.GetExtraActivationData(extraActivationData, 255);
status = LexActivator.GetProductKey(key, 255);
this.statusLabel.Text = “Product genuinely activated!”;
this.activateBtn.Text = “Deactivate”;
this.activateTrialBtn.Enabled = false;
return;
}

Hi,

Please replace the following line:

var key = new StringBuilder();

with

var key = new StringBuilder(256);

Thank you very much, it works very well :wink: