I have to write some tests using moq framework (https://code.google.com/p/moq/). I want to check if some value can be read correctly from a telerik textbox in some ASP.NET application. Therefore I want to mock the telerik text box and give this mock as a parameter to the SUT's method to check if it is read correctly.
Consider:
var telerikFake = new Mock<RadNumericTextBox>();
telerikFake.Setup(x => x.Text).Returns("23,456");
var result = telerikFake.Object; //The exception comes from inside the telerikFake.Object property implementation
Accessing the telerikFake.Object property gives a NullReferenceException with this stack trace:
at Castle.DynamicProxy.AttributeUtil.<GetNonInheritableAttributes>d__0.MoveNext()
at Castle.DynamicProxy.Contributors.ClassProxyInstanceContributor.Generate(ClassEmitter class, ProxyGenerationOptions options)
at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String name, Type[] interfaces, INamingScope namingScope)
at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options)
at Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors)
at Moq.Proxy.CastleProxyFactory.CreateProxy[T](ICallInterceptor interceptor, Type[] interfaces, Object[] arguments)
at Moq.Mock`1.<InitializeInstance>b__0()
at Moq.PexProtector.Invoke(Action action)
Do you have any hints under what circumstances the moq frameworks Mock.Object method leads to this error?
I found a ticket within the MoQ issue list: http://code.google.com/p/moq/issues/detail?id=326 . Are there any developers enabled to fix this issue soon? The ticket was created in 2011.
Regards,
Michael
Related
In the project I am involved with now, we are using dotnet-nswag.dll to generate a typescript api client. I am now trying to switch from using local secrets to secrets stored in azure key vault (I hope to simplify new developers' entry to the project). I however bumped into a problem, that when I use something like below:
builder.ConfigureAppConfiguration((ctx, cfg) =>
{
if (ctx.HostingEnvironment.IsDevelopment())
{
var keyVaultEndpoint = new Uri(Environment.GetEnvironmentVariable("DevEnv_KVUri"));
cfg.AddAzureKeyVault(keyVaultEndpoint, new DefaultAzureCredential());
}
});
I no longer can generate the nswag typescript api client. My investigation led me to the discovery that nswag fails becasue DevEnd_KVUri does not exists at the generation time. I have this env var added in my launchSettigns.json and it is available when I test my app. However, I would like to instruct nswag not to try to include whatever is triggering it to also go through that key vault endpoint.
If I hard-code the url (and it is a KeyVault url that I have access to), then the generation passes. Generated client does not have any endpoints pointing to my hard-coded url. However I do not like the solution, where I have to hard-code (not even fake but a working one) my key vault address.
Unfortunately, I did not find any solution to my problem.
Edit 1:
The command that executes generation:
dotnet "C:\Users\myname\.nuget\packages\nswag.msbuild\13.16.0\build\../tools/Net50/dotnet-nswag.dll" run nswag.json /variables:Configuration=Debug`
The exception thrown by the generator when no url is provided
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'uriString')
at System.Uri..ctor(String uriString)
at Lib.KeyVault.Extensions.IWebHostBuilderExtensions.<>c.<UseKeyVault>b__0_1(HostBuilderContext ctx, IConfigurationBuilder bld) in C:\dotnet\net\lib\Lib.KeyVault.Extensions\IWebHostBuilderExtensions.cs:line 50
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at NSwag.Commands.ServiceProviderResolver.GetServiceProvider(Assembly assembly) in /_/src/NSwag.Commands/HostApplication.cs:line 61
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiGeneratorCommandEntryPoint.Process(String commandContent, String outputFile, String applicationName) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiGeneratorCommandEntryPoint.cs:line 27
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at NSwag.AspNetCore.Launcher.Program.Main(String[] args) in /_/src/NSwag.AspNetCore.Launcher/Program.cs:line 132
System.InvalidOperationException: Swagger generation failed with non-zero exit code '1'.
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 231
at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 275
at NSwag.Commands.NSwagDocument.ExecuteAsync() in /_/src/NSwag.Commands/NSwagDocument.cs:line 81
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 85
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 32
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 61
I am exploring MAUI on macOS. I am porting a WPF application to evaluate the functionalities. The application is connecting to an Azure IoT Hub instance.
Here is the section of code that seems problematic:
var iotHubConnectionStringBuilder = IotHubConnectionStringBuilder.Create("HostName=<iotHubConnectionString>");
var registryManager = RegistryManager.CreateFromConnectionString(iotHubConnectionStringBuilder.ToString());
When calling CreateFromConnectionString, the following exception is thrown:
Unhandled Exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.Http.NSUrlSessionHandler.set_SslProtocols(SslProtocols value)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
at System.Net.Http.HttpClientHandler.InvokeNativeHandlerMethod(String name, Object[] parameters)
at System.Net.Http.HttpClientHandler.SetSslProtocols(SslProtocols value)
at System.Net.Http.HttpClientHandler.set_SslProtocols(SslProtocols value)
at Microsoft.Azure.Devices.Client.Transport.HttpClientHelper..ctor(Uri baseAddress, IAuthorizationProvider authenticationHeaderProvider, IDictionary`2 defaultErrorMapping, TimeSpan timeout, Action`1 preRequestActionForAllRequests, X509Certificate2 clientCert, HttpClientHandler httpClientHandler, ProductInfo productInfo, IWebProxy proxy, Boolean isClientPrimaryTransportHandler)
at Microsoft.Azure.Devices.Client.Transport.HttpTransportHandler..ctor(IPipelineContext context, IotHubConnectionString iotHubConnectionString, Http1TransportSettings transportSettings, HttpClientHandler httpClientHandler, Boolean isClientPrimaryTransportHandler)
at Microsoft.Azure.Devices.Client.InternalClient..ctor(IotHubConnectionString iotHubConnectionString, ITransportSettings[] transportSettings, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, IAuthenticationMethod authenticationMethod, ITransportSettings[] transportSettings, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, IAuthenticationMethod authenticationMethod, TransportType transportType, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, TransportType transportType, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, ClientOptions options)
at Microsoft.Azure.Devices.Client.DeviceClient.<>c__DisplayClass8_0.<CreateFromConnectionString>b__0()
at Microsoft.Azure.Devices.Client.DeviceClient.Create(Func`1 internalClientCreator)
at Microsoft.Azure.Devices.Client.DeviceClient.CreateFromConnectionString(String connectionString, ClientOptions options)
[..]
I have played with the different HttpClient implementation without any positive outcome. And, surprinsingly enough, it exhibits the same callstack, with NSUrlSessionHandler.set_SslProtocols on top of it:
Question
Why is this error thrown and how can it be fixed?
I was using Visual Studio 2022 for Mac version 17.3 Preview 1. After updating to Visual Studio 2022 for Mac v17.3 Preview 1.1 as well as the .net MAUI workload, it worked.
I let the HttpClient implementation to NSUrlSession.
I am not sure the exact reason why it works now but I assume these issues are bound to happen when using preview products.
I am attempting to use SimpleInjector with ASP.NET 5 on an MVC application, and am running into a major problem getting it wired up right.
I run a RavenDB database, and as such I have methods for instantiating instances to it, which is what I use when registering the interfaces, like this;
private void InitializeContainer(IApplicationBuilder app) {
container.CrossWire<IUserStore<AppUser>>(app);
container.CrossWire<UserManager<AppUser>>(app);
container.CrossWire<SignInManager<AppUser>>(app);
container.CrossWire<ILoggerFactory>(app);
container.Register<IDocumentStore>(RavenDatabase.OpenDatabase);
container.Register<IDocumentSession>(RavenDatabase.OpenSession);
container.Register<IAsyncDocumentSession>(RavenDatabase.OpenAsyncSession);
container.Register<ILookupNormalizer>(() => new LowerInvariantLookupNormalizer());
container.Register<IPasswordHasher<AppUser>>(() => new PasswordHasher<AppUser>());
}
The problem seems to be with IUserStore. When I try to load up the application, I get this exception..
Unable to resolve service for type 'Raven.Client.IAsyncDocumentSession' while attempting to activate 'App.Identity.UserStore`1[App.Identity.AppUser]'.
I'm really uncertain why this is, though. I've registered IAsyncDocumentSession, so why can't it inject it? I've also tried it like this...
container.Register<IUserStore<AppUser>>(RavenDatabase.UserStore);
With a method defined as such...
public static UserStore<AppUser> UserStore() {
// check to see if we even have a session factory to get a session from
if (documentStore == null)
OpenDatabase();
return new UserStore<AppUser>(documentStore.OpenAsyncSession());
}
But I still continue to get the exception. I'm at a loss, here. This is my first time using Simple Injector.
Stack Trace
System.InvalidOperationException
Unable to resolve service for type 'Raven.Client.IAsyncDocumentSession' while attempting to activate 'App.Identity.UserStore`1[App.Identity.AppUser]'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.PopulateCallSites(ServiceProvider provider, ISet<Type> callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.CreateCallSite(ServiceProvider provider, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetResolveCallSite(IService service, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetServiceCallSite(Type serviceType, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.PopulateCallSites(ServiceProvider provider, ISet<Type> callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.Service.CreateCallSite(ServiceProvider provider, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetResolveCallSite(IService service, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetServiceCallSite(Type serviceType, ISet<Type> callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType, ServiceProvider serviceProvider)
at System.Collections.Concurrent.ConcurrentDictionaryExtensions.GetOrAdd<TKey, TValue, TArg>(ConcurrentDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TArg, TValue> valueFactory, TArg arg)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService<T>(IServiceProvider provider)
.lambda_method(Closure )
at SimpleInjector.InstanceProducer.BuildAndReplaceInstanceCreatorAndCreateFirstInstance()
at SimpleInjector.InstanceProducer.GetInstance()
SimpleInjector.ActivationException
Unable to resolve service for type 'Raven.Client.IAsyncDocumentSession' while attempting to activate 'App.Identity.UserStore`1[App.Identity.AppUser]'.
at SimpleInjector.InstanceProducer.GetInstance()
at SimpleInjector.InstanceProducer.VerifyInstanceCreation()
System.InvalidOperationException
The configuration is invalid. Creating the instance for type LoginController failed. Unable to resolve service for type 'Raven.Client.IAsyncDocumentSession' while attempting to activate 'App.Identity.UserStore`1[App.Identity.AppUser]'.
System.Reflection.TargetInvocationException
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.AspNet.Hosting.Startup.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNet.Hosting.Startup.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNet.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()
As far as I can see, this problem is not related to Simple Injector. From your registrations, and the exception information I see the following is the case:
You are resolving a LoginController from Simple Injector.
This LoginController depends on Raven.Client.IAsyncDocumentSession.
IAsyncDocumentSession is cross-wired from the ASP.NET configuration system to Simple Injector using CrossWire<IAsyncDocumentSession>.
IAsyncDocumentSession is registered in the ASP.NET configuration system.
The implementation of IAsyncDocumentSession that is registered in ASP.NET depends on UserStore<AppUser>.
The ASP.NET configuration system is unable to resolve that IAsyncDocumentSession registration and throws the exception stating:
Unable to resolve service for type 'Raven.Client.IAsyncDocumentSession' while attempting to activate 'App.Identity.UserStore`1[App.Identity.AppUser]'.
In other words, you would get the same exception when you would either resolve LoginController or IAsyncDocumentSession from the ASP.NET configuration system. Just call one of the following methods and you will see the same error:
app.ApplicationServices.GetRequiredService<LoginController>();
// or
app.ApplicationServices.GetRequiredService<IAsyncDocumentSession>();
I think that the IAsyncDocumentSession implementation depends on UserStore<T> or IUserStore<T>, but you haven't registered it in the ASP.NET configuration system.
When trying to use Moq to setup an indexer property, the underlying Castle library throws an InvalidCastException. I am using Moq 4.0.10827, the details follow. Thanks in advance if anyone can help me get the simple test (below) to run. I am rewriting unit tests with Moq and I am trying to re-do the test for the following method:
public INetwork GetInputNetwork(IInputPortMgr inPortMgr)
{
var port = inPortMgr[0];
return port.InputNetwork;
}
The IInputPortMgr interface is as follows:
public interface IInputPortMgr
{
IInputPort this[int index] { get; }
}
The test I wrote (and tried numerous variations) can be summarized by:
[Test]
public void GetInputNetwork_Returns_InputNetwork_From_InputPort()
{
var mockInPortMgr = new Mock<IInputPortMgr>();
var mockInPort = new Mock<IInputPort>();
var mockNet = new Mock<INetwork>();
mockInPortMgr.Setup(m => m[0]).Returns(mockInPort.Object); // exception here
mockInPort.Setup(m => m.InputNetwork).Returns(mockNet.Object);
// Assertions Here
}
But when run the unit test fails because an exception is thrown by the line
mockInPortMgr.Setup(m => m[0]).Returns(mockInPort.Object);
The details of the exception are:
System.InvalidCastException : Unable to cast object of type 'System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument]' to type 'System.Array'.
at System.Reflection.Emit.CustomAttributeBuilder.EmitValue(BinaryWriter writer, Type type, Object value)
at System.Reflection.Emit.CustomAttributeBuilder.InitCustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] propertyValues, FieldInfo[] namedFields, Object[] fieldValues)
at Castle.DynamicProxy.AttributeUtil.CreateBuilder(CustomAttributeData attribute)
at Castle.DynamicProxy.AttributeUtil.<GetNonInheritableAttributes>d__0.MoveNext()
at Castle.DynamicProxy.Generators.MetaProperty.BuildPropertyEmitter(ClassEmitter classEmitter)
at Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementProperty(ClassEmitter emitter, MetaProperty property, ProxyGenerationOptions options)
at Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(ClassEmitter class, ProxyGenerationOptions options)
at Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator.GenerateType(String typeName, Type proxyTargetType, Type[] interfaces, INamingScope namingScope)
at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCode(Type proxyTargetType, Type[] interfaces, ProxyGenerationOptions options)
at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, IInterceptor[] interceptors)
at Moq.Proxy.CastleProxyFactory.CreateProxy(ICallInterceptor interceptor, Type[] interfaces, Object[] arguments)
at Moq.Mock`1.<InitializeInstance>b__0()
at Moq.Mock`1.InitializeInstance()
at Moq.Mock`1.OnGetObject()
at Moq.Mock`1.get_Object()
at Tests.Psi.Type6.Fx.Type6Fixture.GetInputNetwork() in Type6Fixture.cs: line 293
Any ideas or could anyone point me in the right direction? Thanks.
It's a bug in the version of the Castle DynamicProxy that is merged into the moq binary (Castle.Core 2.5.0.0). It looks to affect attributes that accepts a params argument. I am assuming IInputPort is decorated with such an attribute since the code is not provided?
You could compile moq with the latest version of Castle.Core (3.0.0.0) (ideal).
Or (less ideal), download the latest moq release from Google Code, which includes a moq.dll version without Castle.Core embedded. Reference this in your project along with Castle.Core 3.0.0.0 and add the following binding redirect in your app.config. Since this is a major point upgrade I can't vouch for it's backward compatibility, but I tested this with your code (and an IInputPort interface decorated with an attribute that surfaces the bug in 2.5.0.0) and it worked.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core"
publicKeyToken="407dd0808d44fbdc"
culture="neutral" />
<bindingRedirect oldVersion="2.5.0.0"
newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
This is really basic question and may be duplicate. Can anyone tell me how useful error info generated by any program in .Net.
Today I got an error "Ambiguous match found." while saving entity in database (using EF4)
I can't figure out why this error is coming, what is the root cause. Attached is the snap for same.
Here is the complete Error Details,
System.Reflection.AmbiguousMatchException was unhandled by user code
Message=Ambiguous match found.
Source=mscorlib
StackTrace:
at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetProperty(String name)
at IAA.Data.EntityFramework.RepositoryWithTypedId`2.SaveOrUpdate[T](T entity)
at ABC.XYZ.ApplicationServices.AcknowledgementManagementService.SaveOrUpdate(AcknowledgementFormViewModel acknowledgementFormViewModel) in E:\RA\ABC.XYZ\app\ABC.XYZ.ApplicationServices\AcknowledgementManagementService.cs:line 123
at ABC.XYZ.Web.Controllers.AcknowledgementsController.Acknowledgements(AcknowledgementFormViewModel acknowledgementFormViewModel) in E:\RA\ABC.XYZ\app\ABC.XYZ.Web.Controllers\AcknowledgementsController.cs:line 68
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException:
This means that an System.Reflection.AmbiguousMatchException was thrown, and was not handled. It was thrown at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers), which was called from System.Type.GetProperty(String name), which was called from IAA.Data.EntityFramework.RepositoryWithTypedId2.SaveOrUpdate[T](T entity)`,
etc.
Hmya, no such luck. It would be very nice indeed if the Type.GetProperty() method would actually say which name was ambiguous. But it doesn't and you cannot easily find out. The code lives in the .NET framework and it is optimized, the debugger cannot retrieve the value of the name argument. Your only cue is that your entity model has two properties with the same name. Something like that anyway.
Debugging the .NET Framework can let you move into the call stack to the place where the exception occurs, where you can see local variables.
In Visual Studio 2010, this is as simple as setting Options in the Debugger section. In Visual Studio 2008, there are instructions here.