Entity Framework Tracing Provider: Schema specified is not valid

I’ve been trying to get the Tracing and Caching Provider Wrappers for Entity Framework working and I ran in to a small problem. It turned out it was actually a silly RTFM issue, but in case you miss out a step here’s what happens when it is missed.

In the CreateWrappedMetadataWorkspace method in the EntityConnectionWrapperUtils class a MetadataException is thrown that states:

Schema specified is not valid. Errors:
(0,0) : error 0175: The specified store provider cannot be found in the configuration, or is not valid

This happens on the line that reads:

StoreItemCollection sic = new StoreItemCollection(ssdl.Select(c => c.CreateReader()));

[Note: Your Exception Assistant may show it on a different line but the stack trace in the exception itself will report correctly.]

What I had missed was some config changes I’d somehow missed out when I was setting up the provider. The missing config is:

<system.data>
  <DbProviderFactories>
    <add name="EF Caching Data Provider"
         invariant="EFCachingProvider"
         description="Caching Provider Wrapper"
         type="EFCachingProvider.EFCachingProviderFactory, EFCachingProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
    <add name="EF Tracing Data Provider"
         invariant="EFTracingProvider"
         description="Tracing Provider Wrapper"
         type="EFTracingProvider.EFTracingProviderFactory, EFTracingProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
    <add name="EF Generic Provider Wrapper"
         invariant="EFProviderWrapper"
         description="Generic Provider Wrapper"
         type="EFProviderWrapperToolkit.EFProviderWrapperFactory, EFProviderWrapperToolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
  </DbProviderFactories>
</system.data>

4 Comments

  1. Birko says:

    Hi i have the same problem but i have added this configuration into app.config file but probably into a wrong place. I added it into app.config for the library where i use this providers.

    where exactly must i put this configuration? THX

  2. yo says:

    thanks!!!!

  3. robertdt says:

    Thanks a lot! I’ve been looking most of the day for a solution.

    Great 🙂

  4. Thanks for this. Ran into the same problem when creating a new project and selectively copying over web.config settings.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s