I have an application that I've been using xVal successfully on for quite some time. It was recently updated to MVC 2.
I use the standard DataAnnotations attributes on my domain models, which also implement a "Validate()" method that calls the DataAnnotationsValidationRunner. If there are any errors, that method throws a RulesException.
In my controllers, I use the very typical catch for RulesException
catch (RulesException e)
{
e.AddModelStateErrors(ModelState, "err");
}
All typical stuff, nearly straight from the examples, and working fine until recently (I suspect the problems started at the time of my MVC1 -> MVC2 update.
So the problem is this: When the AddModelStateErrors method gets called, I'm getting a "System.EntryPointNotFoundException : Entry point was not found", which is coming from System.Collections.Generic.ICollection1.get_Count() at System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String expression, String validationMessage, IDictionary
2 htmlAttributes) at System.Web.Mvc.Html.ValidationExtensions.ValidationMessage(HtmlHelper htmlHelper, String modelName, String validationMessage, IDictionary`2 htmlAttributes) at ASP.views_user_edit_aspx.__RenderContent2...{snipped, as it's standard from there}
I've looked at both the code for xVal's method and the HtmlHelper Extension, and I can't seem to figure out what's going on.
Any ideas?
Has the same problem but just solved it: add the following to web.config or app.config, for moving to MVC2:
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
or to MVC3:
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With