AmbiguousMatchException - where to look?

AmbiguousMatchException - where to look?

Old forum URL: forums.lhotka.net/forums/t/12722.aspx


TSF posted on Friday, August 15, 2014

I have a ton of working objects in a WinRT app and have followed the same pattern for all of them. But with a new one I've created, I get the following exception when executing an async Fetch method on a list object.

System.Reflection.AmbiguousMatchException

This occurs when I try to do this:

        public static async Task<ProductCategorySalesInfoList> GetListAsync()
        {
               return await DataPortal.FetchAsync<ProductCategorySalesInfoList>();
        } 

I feel like I've probably missed something somewhere, but can't seem to find it. The stack trace for the inner error of the ErrorInfo object is as follows. Any ideas on where to look or what to look for? Thanks.

 

   at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)   at System.Type.GetMethod(String name, BindingFlags bindingAttr)   at Csla.Reflection.MethodCaller.GetMethod(Type objectType, String method, Boolean hasParameters, Object[] parameters)   at Csla.Reflection.MethodCaller.GetMethod(Type objectType, String method, Object[] parameters)   at Csla.Server.DataPortalMethodCache.GetMethodInfo(Type objectType, String methodName, Object[] parameters)   at Csla.Server.DataPortalMethodCache.GetFetchMethod(Type objectType, Object criteria)   at Csla.DataPortal'1.<DoFetchAsync>d__11.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter'1.GetResult()   at Csla.DataPortal'1.<FetchAsync>d__1b.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter'1.GetResult()   at Csla.DataPortal.<FetchAsync>d__c'1.MoveNext() 

TSF replied on Friday, August 15, 2014

I apologize - I didn't spend enough time looking at the other posts on this subject. In the end, my problem was due to an oversight related to my design. My app runs in an occasionally connected scenario, and as such I use a custom proxy factory to determine when to execute against the local data portal vs. the remote data portal. The DataPortal.FetchAsync<ProductCategorySalesInfoList>() call was intended for the local DP only, but in actuality it was being executed against the remote DP...and the remote (.NET) library didn't have a DP_Fetch method signature that matched.

Copyright (c) Marimer LLC