{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/591","repository_url":"https://api.github.com/repos/simpleinjector/SimpleInjector","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/591/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/591/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/591","id":343984707,"node_id":"MDU6SXNzdWUzNDM5ODQ3MDc=","number":591,"title":"Issue with namespace registration","user":{"login":"simonboyne","id":3603341,"node_id":"MDQ6VXNlcjM2MDMzNDE=","avatar_url":"https://avatars1.githubusercontent.com/u/3603341?v=4","gravatar_id":"","url":"https://api.github.com/users/simonboyne","html_url":"https://github.com/simonboyne","followers_url":"https://api.github.com/users/simonboyne/followers","following_url":"https://api.github.com/users/simonboyne/following{/other_user}","gists_url":"https://api.github.com/users/simonboyne/gists{/gist_id}","starred_url":"https://api.github.com/users/simonboyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonboyne/subscriptions","organizations_url":"https://api.github.com/users/simonboyne/orgs","repos_url":"https://api.github.com/users/simonboyne/repos","events_url":"https://api.github.com/users/simonboyne/events{/privacy}","received_events_url":"https://api.github.com/users/simonboyne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-07-24T10:51:57Z","updated_at":"2018-07-24T15:36:50Z","closed_at":null,"author_association":"NONE","body":"Hi all,\r\nI've an issue with following web service and namespace registration \r\n```csharp\r\nnamespace DTIE.DM.SharePoint.Messaging.SharePointEndPoints.Services\r\n{\r\n    public class AuditProvioningListEndPoint : IRemoteEventService\r\n    {\r\n        public void ProcessOneWayEvent(SPRemoteEventProperties properties)\r\n        {\r\n       try\r\n            {\r\n            Bootstrapper.Start();     \r\n            IConnection connection =Bootstrapper.container.GetInstance<IConnection>();\r\n            IDbConnection test= connection.getConnection();\r\n            ILogging log = Bootstrapper.container.GetInstance<ILogging>();\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n             log.Fatal(ex);\r\n            }\r\n      }\r\n}\r\n}\r\n  ```\r\n\r\nThe following is the registration\r\n```csharp  \r\n container.RegisterConditional(typeof(ILogging),Lifestyle.Transient.CreateRegistration(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_SharePoint_NLog.config\"), container),\r\n            c => c.Consumer.ImplementationType.Namespace.Contains(\"Services\"));\r\n```\r\nWhen attempting to register my logging class for a SharePoint RER web service the Log is null\r\n\r\nThe following registration works for my controller \r\n```csharp \r\n container.RegisterConditional(typeof(ILogging),\r\n            Lifestyle.Transient.CreateRegistration(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_NLog.config\"), container),\r\n            c => c.Consumer.ImplementationType.Namespace.Contains(\"Controllers\"));\r\n```\r\nand \r\n```csharp\r\n container.Register<ILogging>(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_SharePoint_NLog.config\"), Lifestyle.Transient);\r\n\r\n```\r\nWorks in both the controller and the web service.\r\n\r\nAny idea what the issue might be? \r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/407451373","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/591#issuecomment-407451373","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/591","id":407451373,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzQ1MTM3Mw==","user":{"login":"simonboyne","id":3603341,"node_id":"MDQ6VXNlcjM2MDMzNDE=","avatar_url":"https://avatars1.githubusercontent.com/u/3603341?v=4","gravatar_id":"","url":"https://api.github.com/users/simonboyne","html_url":"https://github.com/simonboyne","followers_url":"https://api.github.com/users/simonboyne/followers","following_url":"https://api.github.com/users/simonboyne/following{/other_user}","gists_url":"https://api.github.com/users/simonboyne/gists{/gist_id}","starred_url":"https://api.github.com/users/simonboyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonboyne/subscriptions","organizations_url":"https://api.github.com/users/simonboyne/orgs","repos_url":"https://api.github.com/users/simonboyne/repos","events_url":"https://api.github.com/users/simonboyne/events{/privacy}","received_events_url":"https://api.github.com/users/simonboyne/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T15:36:50Z","updated_at":"2018-07-24T15:36:50Z","author_association":"NONE","body":"  | StackTrace | \"   at DTIE.DM.SharePoint.Messaging.SharePointEndPoints.Bootstrapper.<>c.<Start>b__1_2(PredicateContext c) in D:\\\\Sboyne Code\\\\DTIE.DM.SharePoint.Messaging\\\\DTIE.DM.SharePoint.Messaging\\\\DTIE.DM.SharePoint.Messaging.SharePointEndPoints\\\\App_Start\\\\Bootstrapper.cs:line 56\" | string\r\n\r\nThis is the error message  SimpleInjector.PredicateContext.Consumer.get returned null. \r\n\r\n```csharp\r\n            container.RegisterConditional(typeof(ILogging),\r\n            Lifestyle.Transient.CreateRegistration(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_SharePoint_NLog.config\"), container),\r\n            c => c.Consumer ==null);\r\n\r\n            container.RegisterConditional(typeof(ILogging),\r\n            Lifestyle.Transient.CreateRegistration(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_NLog.config\"), container),\r\n            c => c.Consumer != null && c.Consumer.ImplementationType.Namespace.Contains(\"DAL\"));\r\n\r\n\r\n            container.RegisterConditional(typeof(ILogging),\r\n            Lifestyle.Transient.CreateRegistration(() => new NLogging(Assembly.GetExecutingAssembly().FullName, \"D:\\\\DTIE.SharePoint.DM\\\\DM_NLog.config\"), container),\r\n            c => c.Consumer != null && c.Consumer.ImplementationType.Namespace.Contains(\"Controllers\"));\r\n\r\n```\r\n\r\nSo the cause is because c.Consumer is null.\r\nPerhaps because it's a one way event , does this make any sense? \r\n\r\nIs there a better work around than null checking c.Consumer ?\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"simonboyne"}}