In our code, at some point we do
73: if(someObj.SomeExternalId__c.equals(activeContract.SomeExternalId__c))
74: someObj2.activeContract__r = activeContract;
75: }
But it fails with "Maximum stack depth reached: 12". The debug logs contain this as its last part
15:46:41.322 (6322126573)|SYSTEM_METHOD_ENTRY|[73]|String.equals(Object)
15:46:41.322 (6322139791)|SYSTEM_METHOD_EXIT|[73]|String.equals(Object)
15:46:41.322 (6322145253)|STATEMENT_EXECUTE|[74]
15:46:41.327 (6327980176)|HEAP_ALLOCATE|[74]|Bytes:35
15:46:41.328 (6328096089)|SYSTEM_MODE_EXIT|false
15:46:41.328 (6328249333)|FATAL_ERROR|System.LimitException: Maximum stack depth reached: 12
We have been pulling hairs about possible loops, but we can't find anything for weeks now. It seems as if it fails at line 74 when it allocates memory for the variable assignment, but that should never trigger a stack depth error, right?
Does anybody have a clue?