title: "The invoked member is not supported in a dynamic assembly." after upgrading web app from .NET 3.5 to 4.0
body: <p>I'm attempting to move from VS2008 to VS2010 and want to also upgrade the website to .NET 4.0.  I've copied the source over and ran the conversion wizard with no errors.  There were also no compile errors as well.  However, right when the page loads I get the exception:</p>
  
  <pre><code>System.NotSupportedException was unhandled by user code
    Message=The invoked member is not supported in a dynamic assembly.
    Source=mscorlib
    StackTrace:
         at System.Reflection.Emit.InternalAssemblyBuilder.get_Location()
         at CoreLab.Common.o.a(Assembly A_0)
         at CoreLab.Common.v.a(LicenseContext A_0, Type A_1, String&amp; A_2, String&amp; A_3, String&amp; A_4)
         at CoreLab.Common.v.a(LicenseContext A_0, Type A_1, String&amp; A_2, Boolean&amp; A_3, String&amp; A_4, String&amp; A_5)
         at CoreLab.Common.v.a(LicenseContext A_0, Type A_1, Boolean A_2)
         at CoreLab.Oracle.OracleProviderFactory.CreateConnection()
         at System.Data.EntityClient.EntityConnection.GetStoreConnection(DbProviderFactory factory)
         at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
         at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
         at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
         at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
         at VZW.TrainingPortfolioManager.Entity.TPMEntities..ctor(String connectionString) in C:\TPM_NET4\Entity\TPMEntities.Designer.cs:line 114
         at VZW.TrainingPortfolioManager.Website.Global.Session_Start(Object sender, EventArgs e) in C:\TPM_NET4\Website\Global.asax.cs:line 110
         at System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e)
         at System.Web.SessionState.SessionStateModule.CompleteAcquireState()
         at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
         at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
         at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
    InnerException: 
  </code></pre>
  
  <p>The error happens in code auto-generated by the ADO.NET Entities Framework in the constructor:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Initialize a new TPMEntities object.
  /// &lt;/summary&gt;
  public TPMEntities(string connectionString) : base(connectionString, "TPMEntities")
  {
      OnContextCreated();
  }
  </code></pre>
  
  <p>The exception happens when calling into the base constructor.</p>
  
  <p>Was there some changes made in the entity framework for .NET 4.0 that would require me to do something different or change anything?  I'm pretty much at a loss here.  Thanks!</p>