This project is read-only.


Design Time Data with WPF .NET 4.5


Hi I build a simple test solution in VS 2012 with two projects.

One is a Class library and the other a WPF application.
Both use .NET 4.5.

In the class library I add an EF element (DataFirst) which maps a simple table.

Next I reference this project in my WPF project.
Add EF from Nuget and using a very simple MVVM like pattern I add a class which looks like this (please note - this is not production code - it's just to reproduce the problem).
public class Class1 {
public static Helper TheHelper { get; set; }
public Class1() {
    TheHelper = new Helper();   }}
public class Helper {
public Helper() {
    Nam = "aaa";

string connectionString = "metadata=res://*/Mod.csdl|res://*/Mod.ssdl|res://*/Mod.msl;provider=System.Data.SqlClient;provider connection string=\";data source=.\\sqlx8r2;initial catalog=FCdata;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework\"";
public string Nam { get; set; }
#region PCs
private List<PC> m_lPCs;
public List<PC> PCs {
    get {
        if(m_lPCs == null) {
            try {
                using(FCdataEntities dE = new FCdataEntities(connectionString)) {
                    m_lPCs = dE.PCs.ToList();
            catch(Exception eX) {
                m_lPCs = new List<PC>();
                m_lPCs.Add(new PC() { Description = eX.Message });
        return m_lPCs;
    set {
        if(m_lPCs != value) {
            m_lPCs = value;
            //RaisePropertyChanged(() => PCs);
I also extended the context class like this:
public partial class FCdataEntities : DbContext {
    public FCdataEntities(string strCon) : base(strCon) {
So I can pass the connection string which I copy from app.config.

In my main window I do a simple binding like this:
    Title="MainWindow" Height="350" Width="1525">
    <local:Class1 x:Key="dG" />
<Grid DataContext="{Binding Path=TheHelper, Source={StaticResource dG} }">
        <RowDefinition Height="17*"/>
        <RowDefinition Height="143*"/>
    <TextBox Text="{Binding Nam}"  />
    <ListBox ItemsSource="{Binding PCs}" Grid.Row="1">
                <TextBlock Text="{Binding Description}" />

The solution works fine at runtime.
But in the VS Designer I get an exception shown in my "dummy obect" which I create in the catch block of the property.
Could not load file or assembly 'Windows, Version=, Culture=neutral, ContentType=WindowsRuntime' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
What I need is data at design time - and no "dummy data" - instead I want to get it from the DB - avoiding the use of EF (and use linq2sql for an example) works like a charm.

Did I make a mistake with the connection string (or so) - or is there simply a problem in EF 5.0?
Closed Jul 18, 2013 at 12:11 AM by glennc


RoMiller wrote Feb 14, 2013 at 11:17 PM

EF Team Triage: Assigning to a member of the EF team for further investigation. Once we have investigated the issue we will decide whether to fix it and if so, which release to fix it in.

lajones wrote Mar 19, 2013 at 11:07 PM

Unable to repro - have contacted the reporter to ask for full project.

KurianOfBorg wrote May 16, 2013 at 5:35 AM

I believe this bug has been fixed in the nighlies after Alpha 3. I am also encountering the same error when trying to use live data at design time from my viewmodel.

moozzyk wrote May 16, 2013 at 4:21 PM

This is a duplicate of which was fixed.