Win a free Windows 7 Phone – If you’re lucky

728x90_Banner_WP7DevLaunch

Add an image link for the Windows 7 developer launch in order to have a chance at winning a Windows 7 phone! According to Scott Hanselman. You can see mine on the right toolbar ->

Disabling ValidationExceptions when debugging Silverlight applications

The Problem: After annotating a model with data annotation attributes, Visual Studio halts program execution when the Silverlight application fails on the ValidationException. Continuing execution will display the error on the Silverlight dataform as expected. What you really want is for Visual Studio to ignore the ValidationException and just display the error message on the Silverlight form.

The Fix: Tell Visual Studio to ignore ValidationExceptions. Press cntrl-alt-E to open the Exceptions dialog. Click the Add button and select “Common Language Runtime Exceptions” From the Type dropdown. Enter “System.ComponentModel.DataAnnotations.ValidationException” into the Name box and press ok. Find the line you just added in the Exceptions list and clear the User-unhandled checkbox. Now your exceptions will appear in your app as expected! Happy coding!

 

VisualStudioExceptionsDialog

Method not found: ‘System.Collections.Generic.IDictionary`2 System.Web.Mvc.ModelBindingContext.get_ValueProvider()’

After upgrading an MVC v1.0 project to MVC v2.0 I started getting the following error:

 

 

Method Not found: MVC error

Method Not found: MVC error

 

Turns out this error is caused by the MVC Futures v1.0 Data Annotations library.

The Fix:

  • Remove the reference to System.ComponentModel.DataAnnotations
  • Remove the reference Microsoft.Web.Mvc.DataAnnotations, this is now included as part of MVC 2.0
  • Add a reference to c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.ComponentModel.DataAnnotations
  • Remove the line in Global.asax for setting the default ModelBinder to a new instance of Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.