1
Vote

Using custom Parameter Attribute gives Key Not Found in Dictionary Exception

description

Hi There,
 
We have developed our own custom attribute similiar to the CreateNew attribute in WCSF. We have called it CreateNewOnce so that within an HTTPContext, an object of a particular type is created just once, no matter how many times its property is accessed. I have attached the code below. Now, this worked perfectly in Microsoft.Practices.CompositeWeb.EnterpriseLibrary v 2.0.0.0 but in the new 3.5 version it gives a Key Not found Exception. I have pasted the exception below as well. Its almost as if the Object Builder is unaware of the CreateNewOnce attribute. Do we need to register it somewhere to let Object Builder know of its existance. I would have thought inherting from Parameter Attribute should do that for us. What has changed in the new Object Builder version?
 
Any help will be greatly apreciated. The code breaks at public CreateNewOnceAttribute() { }
 
Thanks Jatin
 
Error:
[KeyNotFoundException: The given key was not present in the dictionary.]
 
System.ThrowHelper.ThrowKeyNotFoundException() +28
 
System.Collections.Generic.Dictionary2.get_Item(TKey key) +7452124
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.Parameters.ParameterResolverMap.GetResolver(ParameterAttribute resolutionAttribute) +77
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.Properties.SetPropertiesStrategy.EmitResolveProperty(ILGenerator il, PropertyInfo prop) +87
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.Properties.SetPropertiesStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild, ILGenerator il) +395
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.PlanBuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +105
 
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.PlanBuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +126
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.DynamicMethodPlanBuilderPolicy.CreatePlan(Type typeToBuild, String idToBuild) +372
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.BuildPlanStrategy.GetPlanFromContext(IBuilderContext context, Type typeToBuild, String idToBuild) +157
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.BuildPlanStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +51
 
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) +245
 
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
 
Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +278
 
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) +255
 
BuildUp_ASP.modules_inbox_inbox_aspx(IBuilderContext , Type , Object , String ) +171
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.DynamicMethodPlan.DynamicMethodBuildPlan.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String id) +63
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.BuildPlan.BuildPlanStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +81
 
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) +245
 
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
 
Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +278
 
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) +289
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase
1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +139
 
Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +55
 
Microsoft.Practices.CompositeWeb.CompositionContainer.BuildItem(IBuilder
1 builder, IReadWriteLocator locator, Object item) +411
 
Microsoft.Practices.CompositeWeb.WebClientApplication.BuildItemWithCurrentContext(Object obj) +187
 
Microsoft.Practices.CompositeWeb.Web.UI.Page.OnPreInit(EventArgs e) +47
 
System.Web.UI.Page.PerformPreInit() +31
 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

file attachments

comments

jatindua wrote Apr 29, 2009 at 12:42 AM

Sorry the Impact is High not Low...

wrote Feb 14, 2013 at 12:58 AM