StateValue System.MethodAccessException

Mar 23, 2009 at 1:05 AM
Edited Mar 24, 2009 at 7:33 AM
I am using VS2008, WCSF 2, StateValue and no problems running locally. But when I deploy the app to dev or uat server I get System.MethodAccessException when I try to set StateValue<T>.Value. This is a public property with the StateDependency attribute. eg

private StateValue<MyType> _currentMyType;

        [StateDependency("CurrentMyType")]
        public StateValue<MyType> CurrentMyType        
        {
            get { return _currentMyType; }
            set { _currentMyType= value; }
        }
The app is running under full trust set in web.config
<trust level="Full" />
Any suggestions? I am really struggling with this one.
Thanks.

exception trace:
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.DynamicMethodBuildPlan.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String id) +51
   Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.BuildPlanStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +80
   Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
   Microsoft.Practices.CompositeWeb.ObjectBuilder.Strategies.SimplifiedSingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +220
   Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +321
   Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
   Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +228
   BuildUp_ASP.datamart_createindexvalues_aspx(IBuilderContext , Type , Object , String ) +113
   Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.DynamicMethodBuildPlan.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String id) +51
   Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.BuildPlanStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +80
   Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
   Microsoft.Practices.CompositeWeb.ObjectBuilder.Strategies.SimplifiedSingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +220
   Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +321
   Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
   Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +256
   Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +119
   Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +50
   Microsoft.Practices.CompositeWeb.CompositionContainer.BuildItem(IBuilder`1 builder, IReadWriteLocator locator, Object item) +349
   Microsoft.Practices.CompositeWeb.WebClientApplication.BuildItemWithCurrentContext(Object obj) +149
   Microsoft.Practices.CompositeWeb.Web.UI.Page.OnPreInit(EventArgs e) +37
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +521