XMLProfileProvider and VS web application project workaround

Feb 18, 2013 at 1:46 PM
Moved line 336 in XmlProfileProvider.cs inside GetPropertyValues() further down the code and the provider starts working in VS2010 web application project. It forces the provider to create its internal setting properties. See below.
         if (!string.IsNullOrEmpty(username)) {
                XmlProfile profile = this.GetProfile(username);

                    foreach (SettingsProperty prop in collection) {
                        if (prop.SerializeAs == SettingsSerializeAs.ProviderSpecific) {
                            if (prop.PropertyType.IsPrimitive || (prop.PropertyType == typeof(string))) {
                                prop.SerializeAs = SettingsSerializeAs.String;
                            }
                            else {
                                prop.SerializeAs = SettingsSerializeAs.Xml;
                            }
                        }
                        coll.Add(new SettingsPropertyValue(prop));
                    }

                    if (profile != null)       // <---- move to here
                    {
                     GetPropertyValues(profile.Names, profile.ValuesString, profile.ValuesBinary, coll);
                    }
            }
Do not know the impact on web site project.