Skip to content

Instantly share code, notes, and snippets.

@ilkerde
Created February 16, 2012 12:52
Show Gist options
  • Save ilkerde/1844629 to your computer and use it in GitHub Desktop.
Save ilkerde/1844629 to your computer and use it in GitHub Desktop.
An unsuccessful attempt to initialize nancy with module instances.
Unhandled Exception: TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRouteResolver ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.RouteCache ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.ModuleInstanceTest.MyModule ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.String ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Char[] ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Int32
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.DefaultRouteResolver ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.Routing.RouteCache ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: Nancy.ModuleInstanceTest.MyModule ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.String ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Char[] ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: System.Int32
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer+SingletonFactory.GetObject (System.Type requestedType, TinyIoC.TinyIoCContainer container, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TypeRegistration registration, TinyIoC.NamedParameterOverloads parameters, TinyIoC.ResolveOptions options) [0x00000] in <filename unknown>:0
namespace Nancy.ModuleInstanceTest {
using System;
using Nancy;
using Nancy.Bootstrapper;
using TinyIoC;
public class MyBootstrapper : DefaultNancyBootstrapper {
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) {
container.Register(typeof(MyModule), MyModule.New());
}
}
}
namespace Nancy.ModuleInstanceTest {
using System;
using Nancy;
public class MyModule : NancyModule {
public MyModule(string path, Func<dynamic, Response> action) {
Get[path] = action;
}
public static MyModule New() {
return new MyModule("/", p => "Works!");
}
}
}
namespace Nancy.ModuleInstanceTest {
using System;
using Nancy;
using Nancy.Hosting.Self;
public class Runner {
public static int Main(string[] args) {
var url = new Uri("http://localhost:8888/nancy/");
var nancyHost = new NancyHost(url);
nancyHost.Start();
Console.WriteLine("Listening...");
Console.ReadKey();
Console.WriteLine("Ok.");
nancyHost.Stop();
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment