Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4123270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:35:24+00:00 2026-05-20T23:35:24+00:00

I’m getting an Ambiguous match found exception in NHibernate when I try to get

  • 0

I’m getting an “Ambiguous match found” exception in NHibernate when I try to get a property by name. I’m attempting to debug it remotely, as it doesn’t happen on my machine, only on the web server :/ So I spat out all the properties visible at any time, and I get this:

Failed to get property Id on UserProxy49b5a83368564e9cbd22b8e2f0a0c5a7!  
All properties: 
property: FirstName of type: System.String readable: True writable: True declared type: UserProxy49b5a83368564e9cbd22b8e2f0a0c5a7
... etc for other properties
property: Id of type: System.Nullable`1[System.Int32] readable: True writable: True declared type: UserProxy49b5a83368564e9cbd22b8e2f0a0c5a7
... etc for other properties
property: HibernateLazyInitializer of type: NHibernate.Proxy.ILazyInitializer readable: True writable: False declared type: UserProxy49b5a83368564e9cbd22b8e2f0a0c5a7
property: Id of type: System.Nullable`1[System.Int32] readable: True writable: True declared type: MyNamespace.ModelBase`1[System.Nullable`1[System.Int32]]

ModelBase is an abstract base class which defines “Id”, so there’s the ambiguity. But two questions are stumping me: how? and why not on my machine? I interact with those proxy objects too, there has never been an ambiguity, but it happens every time on the server.

How can an ambiguity like that even exist? I’ve tried changing my binding flags to .Instance | .Public, but I still get the error (and I change my error output a bit each time, so it’s not just a stale binary). So the object has two properties of identical types and identical names, and .NET allows this…?

To add a few more questions, how can I resolve this, and does anyone have any suggestions for remote debugging? I’m relying on exceptions and manually adding information to the output right now, and that’s hardly efficient.

edit: exact code around the throwing line:

PropertyInfo prop = null;
try {
    prop = root.GetType().GetProperty(props[0], BindingFlags.Instance | BindingFlags.Public); // props[0] == "Id"
}
catch (Exception e) {
    PropertyInfo[] allprops = null;
    allprops = root.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
    StringBuilder sb = new StringBuilder();
    foreach (PropertyInfo p in allprops)
        sb.Append("property: " + p.Name + " of type: " + p.PropertyType + " readable: " + p.CanRead + " writable: " + p.CanWrite + " declared type: " + p.DeclaringType);

    throw new Exception("Failed to get public property " + props[0] + " on " + root.GetType().FullName + "!  All: " + sb.ToString() + " Inner: " + e.Message + " inner stack: " + e.StackTrace, e);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:35:25+00:00Added an answer on May 20, 2026 at 11:35 pm

    Since you don’t specify IgnoreCase I assume that your ambigous match is caused by the proxy inheritance.

    Maybe your local instance has different lazy settings which prevents the entity to be loaded as a proxy object?

    (UserProxy49b5a83368564e9cbd22b8e2f0a0c5a7 indicates that it is a proxy object)

    Are you sure that you are overriding the member correctly? Have you tried BindingFlags.DeclaredOnly? I’m wondering if it tries to return inherited members as well, and that is why you receive the ambigous match exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.