6

I have the following issue with the Second Generation Package, I have this Apex class:

global with sharing class TestClass {
    global virtual class B {
    }
    global class C1 extends B {
    }
    global class C2 extends B {
    }
}

On the foobarbaz namespace, in a managed package, I upload and release a first managed version (v1.0.0) and then, without changing any code at all, I try to create a new minor version (v1.1.0) that have for ancestor the v1.0.0 but I'm getting the following error when I try to create the version:

TestClass: Supertype, foobarbaz.TestClass, relationship must be maintained: foobarbaz.TestClass.C1,TestClass: Supertype, foobarbaz.TestClass, relationship must be maintained: foobarbaz.TestClass.C2

I tested creating a minor version without changing the code source with the First Generation Package, and it's working fine.

So, what's the issue there?

Edit: Here's a Minimium Reproducible Case repository https://github.com/louis-bompart/sturdy-funicular

It's a simple sfdx project setup with sfdx-cli and the aforementioned Apex class. The first commit is the first release (v1.0.0) The second commit is the second attempted release. (v1.1.0)

Edit2: The ancestory tree: https://docs.google.com/drawings/d/10bbSnR5wB1mgfuGNJ3fz_YLEYC-ahevnjqbmZyHECDw/edit?usp=sharing Here's some more elaborated steps on how to reproduce: After the package is created, but no version exists yet:

  • sfdx force:package:version:create -p FooBazBar -v mydevhub@foo.com -x -c
  • sfdx force:package:version:promote --package 04tmypackageid -v mydevhub@foo.com
  • Update sfdx-project.json by adding "ancestorVersion": "0.1.0.1" in the only packageDirectory
  • sfdx force:package:version:create -p FooBazBar -v mydevhub@foo.com -x -c
  • Crash
  • Could you share the package ancestry for your packages ? Similar to here (developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/…) – Mohith Shrivastava Apr 27 at 21:05
  • 1
    It perfectly worked fine for the same code you have. So i am curious how are you creating the packages ? Can you share the commands you executed for this ? – Mohith Shrivastava Apr 27 at 21:41
  • Hi @MohithShrivastava, here's the package ancestry tree: docs.google.com/drawings/d/… For the commands I executed, after the package is created, but no version exists yet: - sfdx force:package:version:create -p FooBazBar -v mydevhub@foo.com -x -c - sfdx force:package:version:promote --package 04tmypackageid -v mydevhub@foo.com - Update sfdx-project.json by adding "ancestorVersion": "0.1.0.1" in the only packageDirectory - sfdx force:package:version:create -p FooBazBar -v mydevhub@foo.com -x -c - Crash. – Louis Bompart Apr 27 at 22:16
  • 1
    Hi @MohithShrivastava, first thanks for your blazing fast answer, that's really appreciated. My mistake, I was not clear in my OP. I'll edit it right away. but the main take-away is that I had the issue with a managed package, not an unmanaged. – Louis Bompart Apr 27 at 23:11
  • 1
    This is definitely a bug. I was able to reproduce it with 2GP managed packaging. – Mohith Shrivastava Apr 28 at 1:10
1

This is been brought to the attention of Salesforce Managed Package team and a bug is raised against this with Internal work item number W-7503352.

Please reference this if you ever raise a support case for this.

There is a known issue created for this now. Please follow for updates.

| improve this answer | |
  • I will also keep updating this as i hear more from product teams. – Mohith Shrivastava Apr 28 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.