jgauffin / griffin.mvccontrib

A contribution project for ASP.NET MVC3
http://blog.gauffin.org/tag/griffin-mvccontrib/
GNU Lesser General Public License v3.0
83 stars 40 forks source link

NullReferenceException on Compare attribute #17

Closed Iv4n2402 closed 12 years ago

Iv4n2402 commented 12 years ago

Behavior similar to issue #6, a NullReferenceException occurs when a Compare attribute is used to compare two fields after submission.

I have double-checked this against your Admin Test Project, which also fails in the same way, as described in issue #6, except line number is 207.

System.NullReferenceException was unhandled by user code Message=Object reference not set to an instance of an object. Source=System.Web.Mvc StackTrace: at System.Web.Mvc.CompareAttribute.IsValid(Object value, ValidationContext validationContext) at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value) at Griffin.MvcContrib.Localization.LocalizedModelValidatorProvider.MyValidator.d5.MoveNext() in C:\projects\git\griffin.mvccontrib\source\Griffin.MvcContrib\Localization\LocalizedModelValidatorProvider.cs:line 207 at System.Web.Mvc.ModelValidator.CompositeModelValidator.d5.MoveNext() at System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) InnerException:

jgauffin commented 12 years ago

I'm back from my vacation and will look at all issues ASAP

Iv4n2402 commented 12 years ago

Hello,

Have you had a chance to take a look at this issue?

jgauffin commented 12 years ago

I've fixed it. Have not committed though since I want to test all validation features first.

Iv4n2402 commented 12 years ago

Neat! As far as I could tell, all other standard validations worked.

Will you be able to commit by tomorrow?

jgauffin commented 12 years ago

Fixed in the next commit