[castle][JIRA] Created: (AR-163) Ambiguous match exception

18 views
Skip to first unread message
Message has been deleted

Darius Damalakas (JIRA)

unread,
Jun 15, 2007, 7:11:09 AM6/15/07
to castle-pro...@googlegroups.com
Ambiguous match exception
-------------------------

Key: AR-163
URL: http://support.castleproject.org//browse/AR-163
Project: ActiveRecord
Issue Type: Bug
Affects Versions: RC 2
Environment: Castle build from build server,
.Net 2.0,
WinForms
FireBird 2
NHibernate.Generics
Reporter: Darius Damalakas
Priority: Critical


After enabling lazy on class,


WARN (e:\Projects\EMC\trunk\EMC.Properties\ReflectionPropertyAccess.cs:115) - Failed on type

CProxyTypeEMC_BLL_ModelGroupModel_NHibernate_ProxyINHibernateProxy1. Requested path SearchCodeProperty
System.Reflection.AmbiguousMatchException: Ambiguous match found.
at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetProperty(String name)


The problem occurs when getting the class indirectly.
I.e. when loading ActiveRecordMediator<Group>.FindAll() returned Group classes are initialized ok, but
if I load students = ActiveRecorcdMediator<Student>.FindAll() and access the group via a property like (
students[0].GroupStudent[0].Group ) then I get the exception

This Issue might be related to http://support.castleproject.org/browse/MR-208


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://support.castleproject.org//secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


hamilton verissimo (JIRA)

unread,
Jun 15, 2007, 7:43:10 AM6/15/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=comments#action_11568 ]

hamilton verissimo commented on AR-163:
---------------------------------------

Is this DP 1 or DP 2?

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo

Darius Damalakas (JIRA)

unread,
Jun 15, 2007, 8:04:10 AM6/15/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=comments#action_11569 ]

Darius Damalakas commented on AR-163:
-------------------------------------

we use DP 1

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo

Ayende Rahien (JIRA)

unread,
Jun 15, 2007, 8:41:10 AM6/15/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=comments#action_11570 ]

Ayende Rahien commented on AR-163:
----------------------------------

Please post the the ReflectionPropertyAccess and student/group code.

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo

Darius Damalakas (JIRA)

unread,
Jun 15, 2007, 8:56:09 AM6/15/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=comments#action_11571 ]

Darius Damalakas commented on AR-163:
-------------------------------------

Similar error registered here:

: http://forum.castleproject.org/viewtopic.php?t=2006&highlight=dynamic+proxy
: http://forum.castleproject.org/viewtopic.php?t=1931&highlight=ambiguous

Proposes a simple solution to use BindingFlags.DeclaredOnly
: http://forum.castleproject.org/viewtopic.php?t=1637&highlight=ambiguous


hammet proposes to try use DP 2
:http://forum.castleproject.org/viewtopic.php?t=1268&highlight=ambiguous

same problem, but no important info provided
:http://forum.castleproject.org/viewtopic.php?t=574&highlight=ambiguous

same problem, but no info
:http://forum.castleproject.org/viewtopic.php?t=404&highlight=ambiguous


It seems that the only thing i can do is to test using DP 2, but this will be done only after weekend.

BTW - correct me if i'm wrong - to test with DP 2 I will have to rebuild NHibernate, after i change all references from DP 1 to DP 2. And castle build server does not build ActiveRecord with DP 2.

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo

Ayende Rahien

unread,
Jun 15, 2007, 9:04:01 AM6/15/07
to castle-pro...@googlegroups.com
You can get NHibernate from the NH trunk, it is using DP2.
After that, you need to rebuild AR with the trunk with NH trunk.

>    at System.RuntimeType.GetPropertyImpl (String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)

Darius Damalakas (JIRA)

unread,
Jun 25, 2007, 6:53:05 AM6/25/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=comments#action_11625 ]

Darius Damalakas commented on AR-163:
-------------------------------------

I moved to DP2, the problem still persists.


@Ayende,
ReflectionPropertyAccess only wraps the call to GetProperty(...) with try catch block, and iterates through all properties until it find the one needed. (see code at the end of comment)


I have attached a project, witch contains all the model classes, and one test case, which throws AmbiguousMatchException. The demo uses DP2 and SQLite.
Attached files contains all necessary libraries, it should be possible to reproduce the bug.

====================
At the moment i can avoid the problem by accessing all properties with simple foreach loop like this:

PropertyInfo pi = null;
try
{
// Try get the needed property
pi = currentType.GetProperty(propertyName);
}
catch (AmbiguousMatchException )
{
// if we get exception, loop through all properties
PropertyInfo[] pis = currentType.GetProperties();

foreach (PropertyInfo propertyInfo in pis)
{
// and choose the property, which we need
if (propertyInfo.Name.Equals(propertyName))
{
pi = propertyInfo;
break;
}
}
}

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo
> Priority: Critical

> Attachments: ActiveRecordLazy.zip

Darius Damalakas (JIRA)

unread,
Jun 25, 2007, 6:53:05 AM6/25/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=all ]

Darius Damalakas updated AR-163:
--------------------------------

Attachment: ActiveRecordLazy.zip

Conrtains a test case, which throws AmbiguousMatchException

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo
> Priority: Critical
> Attachments: ActiveRecordLazy.zip
>
>

hamilton verissimo (JIRA)

unread,
Aug 12, 2007, 12:27:52 PM8/12/07
to castle-pro...@googlegroups.com
[ http://support.castleproject.org//browse/AR-163?page=all ]

hamilton verissimo resolved AR-163.
-----------------------------------

Resolution: Won't Fix

This is a bug confirmed by Microsoft on SRE. I dont expect a fix in a near future.

> Ambiguous match exception
> -------------------------
>
> Key: AR-163
> URL: http://support.castleproject.org//browse/AR-163
> Project: ActiveRecord
> Issue Type: Bug
> Affects Versions: RC 2
> Environment: Castle build from build server,
> .Net 2.0,
> WinForms
> FireBird 2
> NHibernate.Generics
> Reporter: Darius Damalakas

> Assigned To: hamilton verissimo
> Priority: Critical
> Attachments: ActiveRecordLazy.zip
>
>

Reply all
Reply to author
Forward
0 new messages