You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement a custom key/value configuration builder but I keep getting an error when starting up the project:
The connectionStrings section in my web.config looks like this: <connectionStrings configBuilders="MyConfigService"> <clear/> <add name="SystemDBConnection" connectionString="Testing"/> <add name="LoggingDBConnection" connectionString="Testing"/> </connectionStrings>
I also added the section for the configBuilders in my web.config:
My configBuilders section itself looks like this: <configBuilders> <builders> <add name="MyConfigService" mode="Strict" serviceUrlEnvironmentVariableName="configServiceUrl_tst" userEnvironmentVariableName="configServiceUsername_tst" passwordEnvironmentVariableName="configServicePassword_tst" yamlFile="cos-tst.yml" type="Securex.Sigma.ConfigserviceConfigBuilder, Securex.Sigma"/> </builders> </configBuilders>
For simplicity I just used the methods for the sample code (In reality it will go an external http source):
`public class ConfigserviceConfigBuilder : KeyValueConfigBuilder
{
public string ServiceUrlEnvironmentVariableName { get; set; }
public string UserEnvironmentVariableName { get; set; }
public string PasswordEnvironmentVariableName { get; set; }
public string YamlFile { get; set; }
private Dictionary<string, string> _allValues = new Dictionary<string, string>();
public override ICollection<KeyValuePair<string, string>> GetAllValues(string prefix)
{
return new Dictionary<string, string>() { { "one", "1" }, { "two", "2" } };
}
public override string GetValue(string key)
{
return "Value for given key, or null.";
}
protected override void LazyInitialize(string name, NameValueCollection config)
{
base.LazyInitialize(name, config);
ServiceUrlEnvironmentVariableName = UpdateConfigSettingWithAppSettings("serviceUrlEnvironmentVariableName");
UserEnvironmentVariableName = UpdateConfigSettingWithAppSettings("userEnvironmentVariableName");
PasswordEnvironmentVariableName = UpdateConfigSettingWithAppSettings("passwordEnvironmentVariableName");
YamlFile = UpdateConfigSettingWithAppSettings("yamlFile");
}
}`
I had a previous error when implemented the class inside the web-project. Then I had the error similar in #129
So I implemented this inside a separate project but now I get this error. When I continue and debug the class itself everything seems to work and I have no more errors. Also the config loads correctly.
I tried playing with the modes (Strict, Greedy, Expand) but its still the same problem (when Greedy the error in in 'GetValues').
Any ideas if something is 'wrong' in the setup or how to remove this message from popping up?
Best regards,
David
The text was updated successfully, but these errors were encountered:
Probably nothing "wrong" with your setup. The last Q in our FAQ talks about this issue with Visual Studio.
Based on the error text, I would guess that you're using version 2 of these builders - and I would also guess that VS is able to resolve at least your builder assembly. (It could still be a dependent assembly failing to resolve/bind, but I obviously don't see any dependent assemblies in your stripped-down sample code. So it's probably not that.)
You might try working off of the 3.0-preview2 packages, as they handle this 'OpenConfig()' scenario better. (Not perfect, but better.) Hopefully they get you unstuck from this point.
It's also likely a harmless error dialog. Safe to dismiss and continue - albeit rather annoying to even see it.
Hello,
I'm trying to implement a custom key/value configuration builder but I keep getting an error when starting up the project:
The connectionStrings section in my web.config looks like this:
<connectionStrings configBuilders="MyConfigService"> <clear/> <add name="SystemDBConnection" connectionString="Testing"/> <add name="LoggingDBConnection" connectionString="Testing"/> </connectionStrings>
I also added the section for the configBuilders in my web.config:
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false"/>
My configBuilders section itself looks like this:
<configBuilders> <builders> <add name="MyConfigService" mode="Strict" serviceUrlEnvironmentVariableName="configServiceUrl_tst" userEnvironmentVariableName="configServiceUsername_tst" passwordEnvironmentVariableName="configServicePassword_tst" yamlFile="cos-tst.yml" type="Securex.Sigma.ConfigserviceConfigBuilder, Securex.Sigma"/> </builders> </configBuilders>
For simplicity I just used the methods for the sample code (In reality it will go an external http source):
`public class ConfigserviceConfigBuilder : KeyValueConfigBuilder
{
public string ServiceUrlEnvironmentVariableName { get; set; }
public string UserEnvironmentVariableName { get; set; }
public string PasswordEnvironmentVariableName { get; set; }
public string YamlFile { get; set; }
I had a previous error when implemented the class inside the web-project. Then I had the error similar in #129
So I implemented this inside a separate project but now I get this error. When I continue and debug the class itself everything seems to work and I have no more errors. Also the config loads correctly.
I tried playing with the modes (Strict, Greedy, Expand) but its still the same problem (when Greedy the error in in 'GetValues').
Any ideas if something is 'wrong' in the setup or how to remove this message from popping up?
Best regards,
David
The text was updated successfully, but these errors were encountered: