diff --git a/PlexRequests.UI/Bootstrapper.cs b/PlexRequests.UI/Bootstrapper.cs index 03066d1cb..bc8d24665 100644 --- a/PlexRequests.UI/Bootstrapper.cs +++ b/PlexRequests.UI/Bootstrapper.cs @@ -25,6 +25,7 @@ // ************************************************************************/ #endregion +using System.Diagnostics; using System.Net; using Mono.Data.Sqlite; @@ -68,12 +69,14 @@ namespace PlexRequests.UI private IKernel _kernel; protected override IKernel GetApplicationContainer() { + Debug.WriteLine("GetAppContainer"); _kernel.Load(); return _kernel; } protected override void ApplicationStartup(IKernel container, IPipelines pipelines) { + Debug.WriteLine("Bootstrapper.ApplicationStartup"); ConfigureContainer(container); JsonSettings.MaxJsonLength = int.MaxValue; @@ -116,14 +119,18 @@ namespace PlexRequests.UI #endif protected override void ConfigureConventions(NancyConventions nancyConventions) { + Debug.WriteLine("Configuring the conventions"); base.ConfigureConventions(nancyConventions); +Debug.WriteLine("Finished BASE"); + var settingsService = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); + var settings = settingsService.GetSettings(); + var assetLocation = settings.BaseUrl ?? string.Empty; - var settings = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); - var assetLocation = settings.GetSettings().BaseUrl; + Debug.WriteLine($"AssetLocation {assetLocation}"); nancyConventions.StaticContentsConventions.Add( StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content") ); - +Debug.WriteLine("Added Content"); nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui"); nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts"); @@ -166,6 +173,7 @@ namespace PlexRequests.UI protected override void RequestStartup(IKernel container, IPipelines pipelines, NancyContext context) { + Debug.WriteLine("RequestStartup"); //CORS Enable pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) => { @@ -179,6 +187,7 @@ namespace PlexRequests.UI private void ConfigureContainer(IKernel container) { + Debug.WriteLine("Configuring ServiceLoc/Container"); var loc = ServiceLocator.Instance; loc.SetContainer(container); } diff --git a/PlexRequests.UI/Helpers/ContravariantBindingResolver.cs b/PlexRequests.UI/Helpers/ContravariantBindingResolver.cs index f7551d280..0416d8c90 100644 --- a/PlexRequests.UI/Helpers/ContravariantBindingResolver.cs +++ b/PlexRequests.UI/Helpers/ContravariantBindingResolver.cs @@ -26,6 +26,7 @@ #endregion using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; @@ -43,10 +44,16 @@ namespace PlexRequests.UI.Helpers /// public IEnumerable Resolve(Multimap bindings, Type service) { + Debug.WriteLine("Contrar thing"); + if (service.IsGenericType) { var genericType = service.GetGenericTypeDefinition(); var genericArguments = genericType.GetGenericArguments(); + if (!genericArguments.Any()) + { + return Enumerable.Empty(); + } if (genericArguments.Length == 1 && genericArguments.Single().GenericParameterAttributes.HasFlag(GenericParameterAttributes.Contravariant)) { var argument = service.GetGenericArguments().Single(); diff --git a/PlexRequests.UI/Startup.cs b/PlexRequests.UI/Startup.cs index 184f2bba6..f7484bbf2 100644 --- a/PlexRequests.UI/Startup.cs +++ b/PlexRequests.UI/Startup.cs @@ -25,7 +25,7 @@ // ************************************************************************/ #endregion using System; - +using System.Diagnostics; using Ninject; using Ninject.Planning.Bindings.Resolvers; @@ -47,13 +47,24 @@ namespace PlexRequests.UI { try { + Debug.WriteLine("Starting StartupConfiguration"); var resolver = new DependancyResolver(); - var modules = resolver.GetModules(); - var kernel = new StandardKernel(modules); + Debug.WriteLine("Created DI Resolver"); + var modules = resolver.GetModules(); + Debug.WriteLine("Getting all the modules"); + + + Debug.WriteLine("Modules found finished."); + var kernel = new StandardKernel(modules); + Debug.WriteLine("Created Kernel and Injected Modules"); + + Debug.WriteLine("Added Contravariant Binder"); kernel.Components.Add(); + Debug.WriteLine("Start the bootstrapper with the Kernel.ı"); app.UseNancy(options => options.Bootstrapper = new Bootstrapper(kernel)); + Debug.WriteLine("Finished bootstrapper"); var scheduler = new Scheduler(); scheduler.StartScheduler(); }