StackOverFlow Error with a Circular Reference in Apex Code and Debug Levels for Apex Code set to Finest
Last updated 2022-05-13 ·Reference W-7257954 ·Reported By 11 users
When the debug level for Apex code set to finest and there is a circular reference between objects, error appears as an exception System.LimitException: Maximum stack depth reached: 1.
1. Create an Account record named "TestAccount1" and make note of the Id.
2. Create an Assets record named "TestAsset1" and link it to the previously created Account record.
3. Run the following code in workbench or the developer console with debug levels for Apex code set to Finest.
Account acc1 = [Select Id, (Select Id,AccountId from Assets) from Account where Id = <TestAccount Id];
acc1.Assets.Account = acc1;
4. Encounter the error.
Do not set Apex Code = Finest in debug logs.
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.