How to read stack statistics or error information generated in a .Net program to find the root cause of an exception

This is a really basic question and can be duplicate. Can someone tell me how useful error information generated by any program in .Net.

Today I received the error message "Ambiguous match found." storing the object in the database (using EF4) I can not understand why this error occurs, which is the main reason. The attached file is attached to the same.

alt text Here is the complete error information,

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:

+4
source share
3 answers

Well, no such luck. It would be very nice if the Type.GetProperty () method actually said which name was ambiguous. But this is not so, and you cannot easily find out. The code lives in the .NET platform and is optimized, the debugger cannot get the value of the name argument. Your only characteristic is that your object model has two properties with the same name. Something like this anyway.

+2
source

This means that a System.Reflection.AmbiguousMatchException was rejected and it was not handled. It was reset to 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.RepositoryWithTypedId 2.SaveOrUpdate [T] (T entity) `,

and etc.

+3
source

Debugging the .NET Framework allows you to move to the call stack to the place where the exception occurs, where you can see local variables.

In Visual Studio 2010, it is as simple as setting the Parameters in the Debugger section. Visual Studio 2008 has instructions here .

+1
source

All Articles