seesharper / LightInject

An ultra lightweight IoC container
http://www.lightinject.net
MIT License
624 stars 120 forks source link

LightInject.SignalR doesn't work without LightInject.Interception #147

Open Hinidu opened 9 years ago

Hinidu commented 9 years ago

Hello! I've just tried to use LightInject.SignalR and got an exception:

System.Reflection.TargetInvocationException was unhandled
  HResult=-2146232828
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
       at Owin.Loader.DefaultLoader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder)
       at Owin.Loader.DefaultLoader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder)
       at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context)
       at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
       at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions options)
       at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
       at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options)
       at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
       at Microsoft.Owin.Hosting.WebApp.Start(String url)
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.IO.FileNotFoundException
       HResult=-2147024894
       Message=Could not load file or assembly 'LightInject.Interception, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
       Source=LightInject.SignalR
       FileName=LightInject.Interception, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null
       FusionLog==== Pre-bind state information ===
LOG: DisplayName = LightInject.Interception, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null

Installing LightInject.Interception fixes the issue. I didn't register anything in ServiceContainer. I just call serviceContainer.EnableSignalR(hubConfiguration); and this line produces exception above.

Hinidu commented 9 years ago

It seems like it is needed because of this: https://github.com/seesharper/LightInject/blob/master/LightInject.SignalR/LightInject.SignalR.cs#L98-L99

seesharper commented 9 years ago

That is correct. LightInject.SignalR requires Lightinject.interception. If the NuGet package does not install it, I need to update the package. On Tuesday, December 23, 2014, Pavel Platto notifications@github.com wrote:

It seems like it is needed because of this: https://github.com/seesharper/LightInject/blob/master/LightInject.SignalR/LightInject.SignalR.cs#L98-L99

— Reply to this email directly or view it on GitHub https://github.com/seesharper/LightInject/issues/147#issuecomment-67993415 .

puzsol commented 9 years ago

The LightInject.SignalR nuget package still does not automatically include the LightInject.Interceptor package.

Hinidu commented 9 years ago

@puzsol @seesharper I've just updated my PR #148. I've realized that to specify dependency I should modify .nuspec file rather than packages.config. I understand that it is entirely my fault to not learn how NuGet packages are creating but this issue wouldn't hang so long if someone could comment that PR =\

puzsol commented 9 years ago

I didn't omit any of my knowledge on nuget packages :smile: Thanks for working on it.