Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid serial number for shell descriptor #16019

Open
cbadger-montecitobank opened this issue May 8, 2024 · 1 comment
Open

Invalid serial number for shell descriptor #16019

cbadger-montecitobank opened this issue May 8, 2024 · 1 comment
Labels
Milestone

Comments

@cbadger-montecitobank
Copy link

cbadger-montecitobank commented May 8, 2024

I get an "Invalid serial number for shell descriptor" error if I have a module with two data migrations, and each migration executes a recipe with a "Feature" step. Example from DataMigration class:

    public async Task<int> CreateAsync()
    {
        await _recipeMigrator.ExecuteAsync("0001_migration.json", this);

        return 1;
    }

    public async Task<int> UpdateFrom1Async()
    {
        await _recipeMigrator.ExecuteAsync("0002_migration.json", this);

        return 2;
    }

Both recipes ("0001_migration.json" and "0002_migration.json") contain a "Feature" step that is meant to ensure certain core features are activated. If both of these migrations run back-to-back, which would happen when activating the feature for the first time, I get this error when the second recipe runs:

2024-05-08 13:45:50.2348|||0HN3FJV95DQPC:00000001|OrchardCore.Data.Migration.DataMigrationManager|ERR|Error while running migration version 1 for 'My.Test.Modules.FeaturesModule'.
System.InvalidOperationException: Invalid serial number for shell descriptor
   at OrchardCore.Environment.Shell.Data.Descriptors.ShellDescriptorManager.UpdateShellDescriptorAsync(Int32 priorSerialNumber, IEnumerable`1 enabledFeatures)
   at OrchardCore.Environment.Shell.ShellDescriptorFeaturesManager.UpdateFeaturesAsync(ShellDescriptor shellDescriptor, IEnumerable`1 featuresToDisable, IEnumerable`1 featuresToEnable, Boolean force)
   at OrchardCore.Features.Recipes.Executors.FeatureStep.ExecuteAsync(RecipeExecutionContext context)
   at OrchardCore.Recipes.Services.RecipeExecutor.<>c__DisplayClass7_0.<<ExecuteStepAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteStepAsync(RecipeExecutionContext recipeStep)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration)
   at Mbt.Phase7.Modules.FeaturesModule.Migrations.DataMigrations.UpdateFrom1Async() in C:\workspace\Mbt.Phase7\Modules\FeaturesModule\Migrations\DataMigrations.cs:line 24
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId)`

Works fine if I just have the one recipe run.

I'm running on OC 1.8.2. Is there something I'm doing wrong here? Other than abandoning the use of the RecipeMigrator to activate features, is there a way to make this work?

Thank you.

UPDATE: As a work-around for this issue I declared all the features I want activated as dependencies of my module. Orchard activates them automatically, meaning I don't need a migration recipe step. Adding additional dependencies after the feature is activated also seems to work fine, as Orchard will pick up on those and activate them. This meets my need at present, but the original issue presented seems to stand.

@sebastienros sebastienros added this to the 2.x milestone May 9, 2024
@Piedone
Copy link
Member

Piedone commented May 10, 2024

This looks like a bug indeed, so your workaround is what you need to do currently. Declaring dependencies in your module's manifest is recommended anyway if your module indeed depends on them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants