function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Bug in Set of Concrete SObjects

I just hit a strange Apex bug this morning. I have a set of concrete sobjects. If you debug the set, there is only one item. If you debug the set.size() it says that there are two items. When I .addAll() the set to a list, the list has two identical Sobjects. To solve the problem, I need to use a map of the concrete sobjects and then add the .values() of the map to the list.


My guess is that there is a bug in the code does the SObject comparison within the set class.


Can you share your code .





I would, but I don't see a practical way to. The issue is happening in a particular context in our app, and I haven't taken the time to write an example that would work in Anonymous Apex.


Love to see the code here