{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/377","repository_url":"https://api.github.com/repos/simpleinjector/SimpleInjector","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/377/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/377/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/377","id":207555495,"number":377,"title":"Disable resolving concrete types by default","user":{"login":"dotnetjunkie","id":1506621,"avatar_url":"https://avatars2.githubusercontent.com/u/1506621?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnetjunkie","html_url":"https://github.com/dotnetjunkie","followers_url":"https://api.github.com/users/dotnetjunkie/followers","following_url":"https://api.github.com/users/dotnetjunkie/following{/other_user}","gists_url":"https://api.github.com/users/dotnetjunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnetjunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnetjunkie/subscriptions","organizations_url":"https://api.github.com/users/dotnetjunkie/orgs","repos_url":"https://api.github.com/users/dotnetjunkie/repos","events_url":"https://api.github.com/users/dotnetjunkie/events{/privacy}","received_events_url":"https://api.github.com/users/dotnetjunkie/received_events","type":"User","site_admin":false},"labels":[{"id":197762764,"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/breaking%20change","name":"breaking change","color":"555555","default":false},{"id":197522071,"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":197524790,"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/task","name":"task","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-02-14T15:55:13Z","updated_at":"2017-03-11T09:33:23Z","closed_at":null,"body":"Simple Injector currently resolves unregistered concrete types by default. Although this is convenient in a number of cases, it can also lead to errors. Because of this, Simple Injector has several Diagnostic warnings that shield the user from making errors when using concrete unregistered types, such as:\r\n\r\n - [Short Circuited Dependencies warning](https://simpleinjector.readthedocs.io/en/latest/ShortCircuitedDependencies.html)\r\n - [Ambiguous lifestyles warning](https://simpleinjector.readthedocs.io/en/latest/ambiguouslifestyles.html)\r\n\r\nSome improvements in v4 will even improve the likelihood that configuration mistakes are spotted.\r\n\r\nStill however it is possible for the user to shoot himself in the foot, for instance by accidentally resolving a concrete type (when doing dispatching for instance) instead of the interface. This would prevent Simple Injector from being able to apply decorators.\r\n\r\nPerhaps we should disable the creation of unregistered concrete types by default, to prevent these errors and supply a configuration switch that allows the user to re-enable this behaviour, for legacy scenarios:\r\n\r\n``` c#\r\ncontainer.Options.ResolveUnregisteredConcreteTypes = true;\r\n```\r\n\r\nLet's discuss."},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/285855489","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/377#issuecomment-285855489","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/377","id":285855489,"user":{"login":"dotnetjunkie","id":1506621,"avatar_url":"https://avatars2.githubusercontent.com/u/1506621?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnetjunkie","html_url":"https://github.com/dotnetjunkie","followers_url":"https://api.github.com/users/dotnetjunkie/followers","following_url":"https://api.github.com/users/dotnetjunkie/following{/other_user}","gists_url":"https://api.github.com/users/dotnetjunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnetjunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnetjunkie/subscriptions","organizations_url":"https://api.github.com/users/dotnetjunkie/orgs","repos_url":"https://api.github.com/users/dotnetjunkie/repos","events_url":"https://api.github.com/users/dotnetjunkie/events{/privacy}","received_events_url":"https://api.github.com/users/dotnetjunkie/received_events","type":"User","site_admin":false},"created_at":"2017-03-11T09:33:23Z","updated_at":"2017-03-11T09:33:23Z","body":"When you have objects that provide strongly typed access to configuration values, these configuration values should typically be loaded at app startup to ensure the application fails fast in case of a misconfiguration. In case config values are read once at startup, it means that these strongly typed wrappers just wrap the values and are created at startup as well. This means they will be singletons as well.\r\n\r\nWhat you are describing seems an object that contains behavior and forwards the request to something like `ConfigurationManager.AppSettings` which is sub optional.\r\n\r\nThe case where this does make a lot of sense is when the comfig values are volatile and can change during the lifetime of the application."}}
{"actor":{"display_login":"dotnetjunkie"}}