Installing dependent modules via recipe fails


Trying to install my module from a nuget package running the orchard source (v1.1.30) fails.
My module declares a dependency on 'Contrib.Profile' and contains a recipe to install and enable this module.
The problem is described in more detail in this thread:

The problem is in: Orchard.Environment.Features.FeatureManager.EnableFeature
In it the getDisabledDependencies callback is defined. When it is called it has the currentFeatureId passed in as: 'itWORKS.ExtendedRegistration'. This feature has a dependency on 'Contrib.Profile', however the 'Contrib.Profile' feature is NOT available in the featuresState dictionary. Therefore the following call throws an exception:

// Retrieve disabled dependencies for the current feature
                    return feature.Key.Dependencies
                        .Select(fId => featuresState.Single(featureState => featureState.Key.Id == fId))
                        .Where(featureState => !featureState.Value)
                        .ToDictionary(f => f.Key, f => f.Value);
With my little understanding of orchard it seems that the recipe to download and install the 'Contrib.Profile' module is queued: _recipeScheduler.ScheduleWork(executionId);
But the EnableFeature is called before the scheduled work could actually execute.
Maybe the fix is to have an Event fire when the _recipeScheduler has completed an execution and only enable the feature from within that callback.

That explains why it all works, when Contrib.Profile has been installed previously.
Hope this sheds some more light on the problem.
The problem is very easy to reproduce with my nuget package (attached).
If it helps my code is available at: http://extendedregistration.codeplex.com/

file attachments


sebastienros wrote Jan 5, 2012 at 6:22 PM

Fixed in changeset e1de9562fb01

sfmskywalker wrote Mar 28, 2014 at 12:29 AM

Fixed in changeset 07dc0197ad2db6efc208a2ce96c66cdb4fce32ea