We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

CalcQuick and CalcEngine threading

We are currently evaluating Essential Calcualate to perform threaded calculations on data within our middle tier. I''m receiving an exception when attempting to access a new instance of CalcQuick and/or CalcEngine with multiple threads. The question I have is whether or not CalcQuick or CalcEngine support multiple threads.

Here is the code that is throwing the exception:

private void button1_Click(object sender, EventArgs e)
{
for (int index = 0; index < 5; index++)
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerAsync();
}
}

void worker_DoWork(object sender, DoWorkEventArgs e)
{
CalcQuick calc = new CalcQuick();
calc.AutoCalc = false;
calc["A1"] = "1";
calc.SetDirty();
}

Here is one of the exceptions being thrown and the call stack. When and what exception I receive seems to be intermitent.

Argument out of Range exception
Length cannot be less than zero.
Parameter name: length

at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at Syncfusion.Core.Licensing.FusionLicenseProvider.GetAssemblyInformation(Type type, Int32& ver1, Int32& ver2, Int32& ver3, String& assemblyname)
at Syncfusion.Core.Licensing.FusionLicenseProvider.Validate(String str)
at Syncfusion.Core.Licensing.FusionLicenseProvider.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at Syncfusion.Core.Licensing.LicensedComponent..ctor(Type type)
at Syncfusion.Calculate.CalcEngine..ctor(ICalcData ParentObject)
at Syncfusion.Calculate.CalcQuick.InitCalcQuick(Boolean resetStaticMembers)
at Syncfusion.Calculate.CalcQuick..ctor()
at CalcTest.Form1.worker_DoWork(Object sender, DoWorkEventArgs e) in D:\Projects\CalcTest\CalcTest\Form1.cs:line 33
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

2 Replies

AD Administrator Syncfusion Team October 9, 2006 07:25 AM UTC

Here is a link to a sample using your code that does not seem to have a problem.
http://www.syncfusion.com/Support/user/uploads/Calculate_threading_7daf79c8.zip



AD Administrator Syncfusion Team October 9, 2006 07:27 AM UTC

The call stack suggests this might e a licensing issue. You might look at this KB to see if that will avoid this problem.
www.syncfusion.com/support/kb/studio/Default.aspx?ToDo=view&questId=35

Loader.
Live Chat Icon For mobile
Up arrow icon