Skip to main content

Hello community,

I am wondering how can I write a delegate for a method that has "params" argument considering the params argument is needed to be the last parameter in the formal parameter list?
 

public delegate void RunLogActionBaseDelegate(string action, string logType, FSAppointmentDet apptDet, PXSelectBase<FSAppointmentLog> logSelect, params objectc] logSelectArgs);
/PXOverride]
public virtual void RunLogActionBase(string action, string logType, FSAppointmentDet apptDet, PXSelectBase<FSAppointmentLog> logSelect, params objectc] logSelectArgs, RunLogActionBaseDelegate baseMethod)
{
baseMethod?.Invoke(action, logType, apptDet, logSelect, logSelectArgs);
}

I tried to override the method Any help is appreciated.

Have you tried this?

public delegate void RunLogActionBaseDelegate(string action, string logType, FSAppointmentDet apptDet, PXSelectBase<FSAppointmentLog> logSelect, params object[] logSelectArgs);
[PXOverride]
public virtual void RunLogActionBase(string action, string logType, FSAppointmentDet apptDet, PXSelectBase<FSAppointmentLog> logSelect, RunLogActionBaseDelegate baseMethod, params object[] logSelectArgs)
{
//throw new PXException("Ran");
baseMethod(action, logType, apptDet, logSelect, logSelectArgs);
}

 


Hi @darylbowman Thank you for the suggestion. Yes I have tried to insert the Delegate as the first parameter as well as the last parameter befor “params” but in either case I get an error as follows. Sorry I should have mentioned this in my original post to prevent others from wasting time on it.

Method Void RunLogActionBase(System.String, System.String, PX.Objects.FS.FSAppointmentDet, PX.Data.PXSelectBase`1aPX.Objects.FS.FSAppointmentLog], RunLogActionBaseDelegate, System.Objectb]) in graph extension is marked as dPXOverride], but its signature is not compatible with original method

 

Also in case someone else will look into this thread I have tried the below as well

hPXOverride]
public virtual void RunLogActionBase(string action, string logType, FSAppointmentDet apptDet, PXSelectBase<FSAppointmentLog> logSelect, params objecto] logSelectArgs)
{
Base.RunLogActionBase(action, logType, apptDet, logSelect, logSelectArgs);
}

but I get the famous error of 

Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.

 


From what I’m finding on StackOverflow, this isn’t possible, although I’m not certain I understand all of it.


Hi @aaghaei were you able to find a solution? Thank you!


Hi @Chris Hackett I don’t think it is doable


Reply