Strange phenomenon after moving to Visual Studio 2012

By Mirek on (tags: .net 4.5, user control, Visual Studio 2012, WPF, categories: architecture)

Recently we moved our main WPF project to .net framework 4.5 and Visual Studio 2012. Then when I tried to preview some of basic views in Visual Studio designer I faced some strange problems. We have several user controls that we use in our views.

The error we get was

Type 'EditionButtons' initialization failed: The type initializer for ‘<module>.EditionButtons' threw an exception.  

After deeper investigation we found another exception

Cannot set MultiBinding because MultiValueConverter must be specified.

This was mysterious, because when running the application, everything worked fine, including multi bindings in EditionButtons user control where the MultiValueConverter was set and configured properly.
Then we tried to isolate the case, put the control in separate solution and try the simplest case putting the control on the blank view. We get another error saying that resource library or one of its dependency could not be resolved, although it was there and working at runtime. This was a simple library containing .resx files with translations for the UI. Phenomenon!

At last it turned out that the problem was caused by this resource library which was references in the EditionButtons control or rather by fact that VS designer could not properly reference this library in design time.  The resource string was put as a default value for dependency property exposed by mentioned user control

public static readonly DependencyProperty EditCaptionProperty =
        DependencyProperty.Register("EditCaption", typeof(string), typeof(EditionButtons), 
                                     new UIPropertyMetadata(resources.Resources.Edit));

The solution was to put a null or a literal string as default value above and set the proper translated string in style for the EditionButtons in main hosting application.

<Style TargetType="uc:EditionButtons">
    <Setter Property="EditCaption" Value="{x:Static res:Resources.Edit}" />

Fine, but why the developer must struggle with such strange problems and waste time on investigating similar phenomenon. Is this always a matter of too poor knowledge or experience of the developer?