Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Suppress failures to add user secrets #62

Closed
wants to merge 1 commit into from

Conversation

natemcmaster
Copy link
Contributor

Two things can go wrong:

  1. Assembly.Load failures if env.ApplicationName does not correspond to a valid assembly
  2. No UserSecretsIdAttribute on the assembly

Resolves #60

@natemcmaster natemcmaster changed the base branch from dev to rel/2.0.0-preview1 April 26, 2017 16:40
@davidfowl
Copy link
Member

Assembly.Load failures if env.ApplicationName does not correspond to a valid assembly

Super rare. Just let it explode. Other parts of the stack try to Load(env.ApplicationName) already so don't bother.

No UserSecretsIdAttribute on the assembly

I'd rather add detection using reflection than by catching exceptions. No first chance exceptions in ASP.NET Core! 😄

@natemcmaster
Copy link
Contributor Author

How about instead we add an optional setting to the .AddUserSecrets call?

@davidfowl
Copy link
Member

How about instead we add an optional setting to the .AddUserSecrets call?

That was my first choice. Make it like the other providers.

@DamianEdwards
Copy link
Member

A bool to suppress errors?

@natemcmaster
Copy link
Contributor Author

I was thinking of adding .AddUserSecrets(Assembly assembly, bool optional) and .AddUserSecrets<T>(bool optional)

@DamianEdwards
Copy link
Member

Yup

@natemcmaster
Copy link
Contributor Author

K, let's to that. See aspnet/Configuration#654.

I'll open a PR to use the optional = true setting when it's it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants