6

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 :)

2 Answers 2

2

RE: User defined type found in unsupported code path. There appears to be some relationship between this error and the use of Set methods in Apex judging by these two forum posts here and here. Other than that I can find no other reference to it, this could be a relatively new platform bug / regression might be the explanation.

RE: Developer Console Issue. This is also very strange, maybe the presence of the Debug logs being enabled? Have you tried enabling Debug logs under the Monitoring and viewing the logs from this place. Its not as good as Developer Console but an alternative you could try. Your other final option is to create a Debug custom object and output records insert new Debug__c ( Message__c = 'My debug message' );

enter image description here

RE: Contacting Salesforce Support. If you have a Partner Portal login, you can raise cases through this. This is the only way I am familar with, but in absence of that, I guess my next port of call would be the Help link (top right next to your name when logged into your DE org) and then follow the links below to open a case.

enter image description here

enter image description here

Hope the above helps!

1

32 things - firstly I would raise this as a bug with Salesforce as Andrew mentioned.

Secondly (and I know this sounds daft) try completely restarting your browser (which in Chrome will mean killing all the processes as well). I have seen people have issues with the Developer Console where doing this can sometimes work.

Thirdly, Andrew mentioned this seems to be with Set methods. I assume you have implemented the hashCode and equals methods? Make sure these do work correctly (not suggesting you won't have) but I have a theory that your type that is being compared will have a reference to a custom type within it that is being compared and as such is blowing up.

Let me know if that helps or if you get any different feedback from doing it.

1
  • 1
    My custom classes aren't used as keys in a Set or Map anywhere, so shouldn't need a hashCode or equals (?) - I am however using custom Enums as keys, which I think is part of the issue. Feb 7, 2013 at 1:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .