This comes up from time to time. Acumatica will throw an error (popping up an error box). It is usually on the "MoveNext" command, but it sometimes happens in other events. But when I attach VS2022 to the IIS app, it never throws an error inside of my debugger, so I can't see where the problem is.
This is the latest example of this...
First this is the C# Extension code:
public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint>
{
internal CurrentCostingInfo currentCostingInfo = null;
public static bool IsActive()
{
return true;
}
protected virtual void _(Events.RowSelecting<CROpportunity> e, PXRowSelecting InvokeBaseHandler)
{
if (e.Row == null) return;
var row = e.Row as CROpportunity;
if (UseMarkupInsteadOfMargin == null || !UseMarkupInsteadOfMargin.HasValue)
UseMarkupInsteadOfMargin = false;
SetDisplayFor_MarkUpOrMargin("CROpportunity", UseMarkupInsteadOfMargin, e.Cache);
using (new PXConnectionScope())
{
SetOpportunityMarginTotals(row);
}
int h = 0;
}
protected virtual void _(Events.FieldSelecting<CROpportunity, CROpportunity.status> e)
{
if (e.Row == null) return;
}
protected virtual void _(Events.FieldDefaulting<CROpportunity, CROpportunity.status> e)
{
if (e.Row == null) return;
}
protected virtual void _(Events.RowSelected<CROpportunity> e, PXRowSelected InvokeBaseHandler)
{
int i = 0;
InvokeBaseHandler?.Invoke(e.Cache, e.Args);
int f = 0;
}
When I Run it, this is what happens:
1) IsActive() gets hit, of course.
2) Then I hit the (Events.FieldSelecting<CROpportunity, CROpportunity.status> e) 5 times.
3) Then I hit the Events.RowSelecting<CROpportunity> method.
4) When I leave RowSelecting, I don't hit any more breakpoints, but this error message shows in Acumatica:
RowSelected() is never hit, and neither is the FieldDefaulting method.
This is the Trace info for Exceptions:
System.InvalidCastException2023-06-05 17:58:45 UTC Specified cast is not valid.
PX.Data.PXException2023-06-05 17:58:45 UTC Error: An error occurred during processing of the field Account ID:
Specified cast is not valid.. PX.Data.PXException2023-06-05 17:58:45 UTC Error: An error occurred during processing of the field Account ID:
Specified cast is not valid.. PX.Data.PXException2023-06-05 17:58:45 UTC Error: An error occurred during processing of the field Account ID:
So the issue is with "AccountID" -- except there is no AccountID field in the database table that I can see.
How do I go about seeing what is really going on? I need it to allow the system to throw an error, but it seems to be suppressing that and handling it in the popup, which tells me next to nothing.