philiplaureano/LinFu — Issue #21: IndexOutOfRangeException when calling proxy object's intercepting method
Author: caprofage
Created: 2012-02-07 12:42:42+00:00
State: open

We have an error with following description when using proxy of our interfaces generated by Linfu.Core 2.3 in website application.

Description from EventLog:

Exception information:
Exception type: IndexOutOfRangeException
Exception message: Index was outside the bounds of the array.

Request information:
Request URL: http://[OUR_SITE]/xxx
Request path: /path
User host address: xx.xx.xx.xx
User: 1586068
Is authenticated: True
Authentication Type: Forms
Thread account name: IIS APPPOOL\App

Thread information:
Thread ID: 50
Thread account name: IIS APPPOOL\App
Is impersonating: False
Stack trace: at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
at LinFu.AOP.Cecil.IgnoredInstancesRegistry.AddInstance(Object target)
at LinFu.Proxy.IBlockServiceProxy-05990fd14dbb49659cd0ebe8d8e66327.System.IDisposable.Dispose()
at MyProj.ContactList.ContactListAdapter.GetBlockedUsers(Member owner) in C:\!Projects\xxx\ContactListAdapter.cs:line 174

Error appears only with Linfu.Core version 2.3 and only in applications with a great level of concurrent calls.

IBlockServiceProxy is a proxy of our interface. When we generate proxy by ProxyFactory object we mixin additional IDisposable interface like this:

_proxyFactory.CreateProxy(_interceptor, typeof(IDisposable))

And error occures when Dispose is called implicitly in using operator. In interceptor we have some logic for intercepting dispose call.