/// <summary> /// Dynamic failure constructor. /// </summary> internal YodiiEngineResult(IConfigurationSolver solver, IEnumerable <Tuple <IPluginInfo, Exception> > errorInfo, YodiiEngine engine) { Debug.Assert(solver != null); Debug.Assert(errorInfo != null && errorInfo.Any()); Debug.Assert(engine != null); var allP = solver.AllPlugins.Select(p => new SolvedPluginSnapshot(p)).ToDictionary(ps => ps.PluginInfo); var allS = solver.AllServices.Select(s => new SolvedServiceSnapshot(s)).ToReadOnlyList(); var errors = errorInfo.Select(e => new PluginRuntimeError(allP[e.Item1], e.Item2)).ToReadOnlyList(); _pluginCulprits = errors.Select(e => e.Plugin.PluginInfo).ToReadOnlyList(); _serviceCulprits = _pluginCulprits.Select(p => p.Service).Where(s => s != null).ToReadOnlyList(); _engine = engine; _hostFailureResult = new DynamicFailureResult(new DynamicSolvedConfiguration(allP.Values.ToReadOnlyList(), allS), errors); }
/// <summary> /// Dynamic failure constructor. /// </summary> internal YodiiEngineResult( IConfigurationSolver solver, IEnumerable<Tuple<IPluginInfo, Exception>> errorInfo, YodiiEngine engine ) { Debug.Assert( solver != null ); Debug.Assert( errorInfo != null && errorInfo.Any() ); Debug.Assert( engine != null ); var allP = solver.AllPlugins.Select( p => new SolvedPluginSnapshot( p ) ).ToDictionary( ps => ps.PluginInfo ); var allS = solver.AllServices.Select( s => new SolvedServiceSnapshot( s ) ).ToReadOnlyList(); var errors = errorInfo.Select( e => new PluginRuntimeError( allP[e.Item1], e.Item2 ) ).ToReadOnlyList(); _pluginCulprits = errors.Select( e => e.Plugin.PluginInfo ).ToReadOnlyList(); _serviceCulprits = _pluginCulprits.Select( p => p.Service ).Where( s => s != null ).ToReadOnlyList(); _engine = engine; _hostFailureResult = new DynamicFailureResult( new DynamicSolvedConfiguration( allP.Values.ToReadOnlyList(), allS ), errors ); }