Sorry for not having an answer to your question, but why do you want to proxy an empty interface? On Jan 28, 2011 12:20 AM, "Nick Peeples" <[email protected]> wrote: > I have a very simple example, but it fails. > > using System; > using Castle.DynamicProxy; > using Castle.MicroKernel.Registration; > using Castle.Windsor; > > namespace Castle.Stuff.Tests { > public interface IInterface { > } > > public class Program { > public static void Main(string[ ] args) { > using (var c = new WindsorContainer()) { > c.Register( > Component.For<IInterface>() > .UsingFactoryMethod(() => { > var gen = new ProxyGenerator(); > var proxy = > gen.CreateInterfaceProxyWithoutTarget<IInterface>(); > return proxy; > }) > ); > > c.Resolve<IInterface>(); > Console.Write("end..."); > Console.ReadLine(); > } > } > } > } > > During the resolution, there is a deep NullReferenceException coming from > within windsor. Should this example be possible? If it's not possible, how
> would I go about doing something like this? > > Thanks, > Nick > > p.s. stack trace - > at System.Object.GetType() > at > Castle.MicroKernel.LifecycleConcerns.LateBoundConcerns.Apply(ComponentModel > model, Object component) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\LifecycleConcerns\LateBoundConcerns.cs:line > 48 > at > Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.ApplyConcerns(IEnumerable`1 > steps, Object instance) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:line > 235 > at > Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.ApplyCommissionConcerns(Object > instance) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:line > 216 > at > Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext > context) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\ComponentActivator\DefaultComponentActivator.cs:line > 77 > at > Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext > context) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\ComponentActivator\AbstractComponentActivator.cs:line > 75 > at > Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext > context) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Lifestyle\AbstractLifestyleManager.cs:line > 42 > at > Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext > context) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Lifestyle\SingletonLifestyleManager.cs:line > 50 > at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext > context, Boolean requiresDecommission, Boolean instanceRequired) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Handlers\DefaultHandler.cs:line > 61 > at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext > context, Boolean instanceRequired) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Handlers\AbstractHandler.cs:line > 771 > at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext > context) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Handlers\AbstractHandler.cs:line > 369 > at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, > Type service, IDictionary additionalArguments) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:line > 904 > at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, > Type service) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:line > 888 > at Castle.MicroKernel.DefaultKernel.Resolve(Type service) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel_Resolve.cs:line > 161 > at Castle.Windsor.WindsorContainer.Resolve(Type service) in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line > 779 > at Castle.Windsor.WindsorContainer.Resolve[T]() in > e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line > 868 > at Castle.Stuff.Tests.Program.Main(String[] args) in > C:\src\castle-stuff\src\Castle.Stuff.Tests\Program.cs:line 22 > at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext > executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > > -- > You received this message because you are subscribed to the Google Groups "Castle Project Users" group. > To post to this group, send email to [email protected] . > To unsubscribe from this group, send email to [email protected]<castle-project-users%[email protected]> . > For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
