I have a complex codebase containing numerous custom classes, subclasses, inner classes, and enums. (I specifically mention this, as I have a hunch the enums are the cause, but I can't replicate in a smaller test project)
One particular code path is executed by a visualforce page.
It works relatively perfectly, until I open the "Developer Console" and try to view the debug log.
So long as the developer console is open (in another tab), I get the following error when rendering that visual force page.
"System.UnexpectedException: User defined type found in unsupported code path."
Closing the debug log returns everything to normal.
Based on this my assumption is that one or more of my custom types is making it into a section of code it's not supposed to be via the debug log, and tripping up a sanity check.
Unfortunately, this prevents me from being able to debug my application.
Has anyone experienced this issue and managed to find a resolution?
Also - If any salesforce devs are listening, how do I go about filing this as a bug report? It looks like it might be a platform bug.
EDIT - So I've managed to figure it out - the issue is caused by calling 'contains' on an Set of custom Enums - but only while overriding debug logging.
To replicate - Create the following class
public class TestSalesforceBug {
enum Day {
MON, TUE, WED, THU, FRI
}
@IsTest static void testMe(){
Set<Day> d = new Set<Day>{
Day.MON, Day.TUE, Day.WED
};
if( d.contains( Day.MON )){
System.debug('Has Monday');
}
}
}
Then open a debug console or tick "Override Log Filters" on the class within setup->develop->classes
Then execute this by click "Run Test" on the same screen; It will throw the error "System.UnexpectedException: User defined type found in unsupported code path"
I'm going to submit this as a ticket with salesforce.
Edit: This appears to have been fixed by salesforce now :)