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
GennadiyGennadiy 

Compilation errors in the installed manager package

Hi,

We are developing and supporting a managed package in AppExchange, which works with ContentVersion objects. Last 3 weeks we started to get strange notifications from the client organizations (at the same time it's interesting to note that we didn't get any complaints from them). And we've never got such notifications previously.

The issue looks like a compilation error in the codebase. We don't believe that it's possible because of our implementation, because our package is managed and, of course,it is compiled every time when we upload a new version. Also our current codebase in the development instance is still compilable and we didn't reproduce any compilation errors in test environments where we installed the same version as our customers have.

Moreover, there is a strange first line in the stack trace, which is included in the notification:
System.test: line 32, column 17: Invalid type: Component.Apex.Page
It references to the System class, not to one of our classes. This fact makes us think that the problem is somehow related with the system changes.

We know that last 3 weeks Salesforce was delivering a new Winter 16 Release, and, maybe, the problem is somehow related with this fact, but we are not sure.

Here is full text of the typical notification:
Apex script unhandled trigger exception by user/organization: UserId/OrgId

TriggerForContentDocuments: execution of AfterUpdate

caused by: line 11, column 3: trigger body is invalid and failed recompilation: Dependent class is invalid and needs recompilation:
(package_name)
(package_name)
(package_name)
(package_name)
package_name.OneOfOurClasses: line 18, column 8: Dependent class is invalid and needs recompilation:
System.test: line 32, column 17: Invalid type: Component.Apex.Page

Maybe, someone of you met similar problems before or have any ideas what this issue may mean. Any help is appreciated. Thank you.
scottbcovertscottbcovert
Hi Gennadiy,

This is a head scratcher for sure. One thing I've noticed that can cause issues for ISVs when Salesforce has new releases is if your managed package is written to interact with client's custom code/metadata either via dynamic Apex and/or through Apex inheritance in the form of abstract/virtual classes & interfaces. The reason is that even though the API of your VFPages and Apex classes/triggers may have remained the same your app might be interfacing with other classes/metadata using a different API and sometimes this can cause strange behavior. If this sounds like it could pertain to your managed package then it might be worth investigating further.
GennadiyGennadiy
Hi scottbcovert. Thank you for this interesting response.

We thought about the same reason too, but decided that it's irrelevant for our situation. Our code does not interact with custom metadata or classes from other packages (as well as with client's metadata/classes). We use only system utilities provided by Apex. Regarding database objects, we use several custom objects that are included in our package and, of course, several standard objects (ContentVersion, ContentDocument, User).
Regarding the inheritance, we use virtual and abstract classes, but all base classes are our classes and they are, of course, included in the package.

So, the package does not have references to 3rd party code/metadata.

There is one more interesting thing. We've communicated with one of our clients. He still didn't report us about any problems with the package. OK, we asked him to re-compile all classes using the 'Compile All Classes' link and he didn't meet any compilation issues in his org. Everything looks good.

So, we still have no understanding where and why the issue happens and why the stack trace starts with this strange line:
System.test: line 32, column 17: Invalid type: Component.Apex.Page

My only thought: maybe, Salesforce starts some testing internally and there is a defect in the testing mechanism (Maybe, the problem is somehow related with the new 'Apex Hammer Execution' feature in Salesforce). Probably, it sounds a little bit strange, but no other ideas.
scottbcovertscottbcovert
Hi Gennadiy,

Rats, I'm not sure what the issue could be then. My advice would be to open a ticket with Salesforce support through the partner portal and hopefully they can escalate it internally to an engineer that can help. Afterwards I'd recommend posting their response to this thread so if others come across it they can benefit from your findings-best of luck!
GennadiyGennadiy
Yes, we tried already. Unfortunately they said this would need to go to the "developer support team" which requires a premier partner membership, and we have only a basic plan. They suggested to discuss the problem here :)

But we do not despair and will continue our research. Of course, we will post our findings here if they are.

Again, thank you for responses.
VarunCVarunC
Did you find any workaround to this issue? If there is a way a package developer could fix it in his code?
GennadiyGennadiy
Hi, vc4u.

Unfortunately, we still have no any workaround or at least explanation of why this issue is happening. We still get automatic emails from our clients with this issue, but nobody reports about a real problem with the app. So, we still can't explain this.

It would be great if you post your error here and share the following information:
- do your emails say the error happens in a trigger?
- if yes, then for which SObject do you use this trigger?
- have you been able to find a stable scenario to reproduce the problem in 100% cases?

We will have more chances to fix the problem together (or force SF to fix it), if we provide more information to the community.
Thank you.
VarunCVarunC
My scenerios is exactly like yours:
- Error happened in Apex Trigger
- Trigger sObject is 'ContentVersion'
- It says same exact message of error :
Dependent class is invalid and needs recompilation:
System.test: line 32, column 17: Invalid type: Component.Apex.Page

And the issue is not reproducible 100% of times, heck we were not able to reproduce it even once in ANY of our test environments :( and the errors just randomly pops up here and there from any user org.

We tried executing "Compile all classes" in one org but still after few days, again the error poppup up from that org into my mailbox.

 
GennadiyGennadiy
And I think your trigger fires after update, as well as mine. If so, then we really observe the same issue.

I'm still sure that it's related with Salesforce internal defect, because
  1. There are can't be compilation errors in managed packages. If there is a compilation error in a codebase, a new package will not be created.
  2. The stack trace refers to System class with the strange test() method. It also says about Component.Apex.Page which is, of course, an internal class.
So, I hope SF technical guys review topics in this community and will notice this defect one fine day.

I'll let you know of any new information and hope you will.
GennadiyGennadiy
Hi, vc4u.
I have one more idea. Could you send me code (to "gpsfdc@yandex.ru" address) of your custom APEX class that is mentioned at the end of your stack trace (exactly before the last line which refers to System.test: line 32...)? I will compare it with my class and try to find common blocks. And I'll publish the results here (if they are).