Jun 1, 2011 at 2:04 AM
Edited Jun 1, 2011 at 2:10 AM
I could not find anything wrong, so I went ahead and installed the nuget package running the orchard source (v1.1.30).
This actually seems to be a bug in Orchard.
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
.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. If you need the file just let me know.
If it helps my code is available at: