Weird Binsor loading/LINQ IndexOutOfRangeException

15 views
Skip to first unread message

robbie g

unread,
Oct 29, 2009, 10:02:20 AM10/29/09
to Rhino Tools Dev
I am registering components as follows in a windsor.boo file

# -- Command Message Handlers --
for type in AllTypes("OzoneHR.Commands") \
.Where( { t as System.Type | t.Namespace.StartsWith
("OzoneHR.Commands.Handlers") }):
component type.GetInterfaces()[0], type

I am getting the exception below when the container loads, NOT when
the command gets called when using one of the LINQ extension methods
in a registered class

e.g.

_collection.Where(a => a.Field == 123);

This is pretty weird, it kind of feels like an Assembly loading
problem. I've tried debugging and stepping to the line (186) but I
cannot even get there, seems to die early or something strange.

Can't make any sense of it. Any clues?

------------------------------------------------------------------------------------
Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside
the bounds of the array.

Source Error:

Line 184: IWindsorContainer container = CreateContainer
(windsorConfig);
Line 185: container.Kernel.Resolver.AddSubResolver(new
ArrayResolver(container.Kernel));


Line 186: BooReader.Read(container, "windsor.boo");
Line 187: //IWindsorContainer container = new
WindsorContainer().Install(BinsorScript.FromFile("windsor.boo"));


Line 188: IoC.Initialise(container);

[IndexOutOfRangeException: Index was outside the bounds of the array.]


windsor.Run() in c:\windows\system32\inetsrv\windsor:132
Rhino.Commons.Binsor.BooReader.Execute(IWindsorContainer container,
AbstractConfigurationRunner abstractConfiguration) +149
Rhino.Commons.Binsor.BooReader.Read(IWindsorContainer container,
String fileName, String environment, GenerationOptions
generationOptions, String[] namespaces) +128


Rhino.Commons.Binsor.BooReader.Read(IWindsorContainer container,
String fileName, String environment, String[] namespaces) +88
Rhino.Commons.Binsor.BooReader.Read(IWindsorContainer container,
String fileName, String[] namespaces) +83


OzoneHR.Web.UnitOfWorkApplication.CreateContainer() in D:\Projects
\OzoneHR\trunk\Presentation\OzoneHR.Web\UnitOfWorkApplication.cs:186
OzoneHR.Web.UnitOfWorkApplication.InitializeContainer
(UnitOfWorkApplication self) in D:\Projects\OzoneHR\trunk\Presentation
\OzoneHR.Web\UnitOfWorkApplication.cs:120


OzoneHR.Web.UnitOfWorkApplication.Application_Start(Object sender,
EventArgs e) in D:\Projects\OzoneHR\trunk\Presentation\OzoneHR.Web
\UnitOfWorkApplication.cs:112
OzoneHRMVC.GlobalApplication.Application_Start(Object sender,
EventArgs e) in D:\Projects\OzoneHR\trunk\Presentation\OzoneHR.Website
\Global.asax.cs:127



[HttpException (0x80004005): Index was outside the bounds of the
array.]

System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode
(HttpContext context, HttpApplication app) +4170257
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +205


System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance
(IntPtr appContext, HttpContext context) +350


System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +382

[HttpException (0x80004005): Index was outside the bounds of the
array.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+11301302


System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate
(IIS7WorkerRequest wr, HttpContext context) +4338644

Ayende Rahien

unread,
Oct 29, 2009, 11:37:08 AM10/29/09
to rhino-t...@googlegroups.com
I think this is the problem:
     component type.GetInterfaces()[0], type

robbie g

unread,
Nov 6, 2009, 7:50:43 AM11/6/09
to Rhino Tools Dev
I don't think the problem is with how we're registering components

If I have a LINQ call in my registered component then I get the error

If I comment it out (or replace it with a foreach or somesuch) then
all the component registration without errors.

Any ideas?

On Oct 29, 3:37 pm, Ayende Rahien <aye...@ayende.com> wrote:
> I think this is the problem:
>      component type.GetInterfaces()[0], type
>
Reply all
Reply to author
Forward
0 new messages