I am using CANoe tool for CAPL scripting.
And I have referred this link for help given by Vector: https://vector.com/portal/medien/cmc/application_notes/AN-IND-1-011_Using_CANoe_NET_API.pdf
Now I am facing issue at step or section: 2.7 Calling CAPL Functions. There are no syntax errors, but I think, the code is not able to retrieve the function from the CAPL file as it is giving this error when I pass values to the function from C# code.
Error statement:
An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in System.Core.dll but was not handled in user code
Additional information: Cannot convert null to 'int' because it is a non-nullable value type
If there is a handler for this exception, the program may be safely continued.
Can some one tell me what exactly the issue is?
Code:
public void Init()
{
CANoe.Application myApp;
myApp = new CANoe.Application();
CANoe.Measurement mymeasure;
mymeasure = (CANoe.Measurement)myApp.Measurement;
myApp.Open(@"D:\Planter CAPl\CANoeCAPLdll.cfg", true, true);
CANoe.OpenConfigurationResult ocresult = myApp.Configuration.OpenConfigurationResult;
if (ocresult.result == 0)
{
CANoe.CAPL CANoeCAPL = (CANoe.CAPL)myApp.CAPL;
CANoeCAPL.Compile(null);
CANoe.CAPLFunction mydata;
mydata = (CANoe.CAPLFunction)CANoeCAPL.GetFunction("Data");//CANoeCAPL.GetFunction("DataShare");
mymeasure.Start();
Thread.Sleep(2000);
int Result = (int)mydata.Call(10,20,30);// Exeception error is coming at this point*
if (mymeasure.Running)
{
mymeasure.Stop();
}
}
}