public virtual void Start()
{
try
{
this.state = BundleState.Starting;
EventManager.OnBundleChanged(new BundleEventArgs(BundleTransition.Starting, this));
domain = framework.CreateDomain(this.Context);
Debug.Assert(domain != null, "Bundle AppDomain can't be set to null.");
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve);
assembly = Assembly.LoadFrom(Utility.FileHelper.FileCopyToDynamicDirectory(location));
Debug.Assert(assembly != null, "Bundle Assembly can's be set to null.");
foreach (IBundleActivator activator in this.Acitvators)
{
if (activator == null)
{
throw new BundleException("No activator for: " + this.Location);
}
activator.Start(this.Context);
}
this.state = BundleState.Active;
EventManager.OnBundleChanged(new BundleEventArgs(BundleTransition.Started, this));
}
catch (Exception ex)
{
this.state = BundleState.Installed;
throw new BundleException(ex.Message, ex);
}
}