{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/3430","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3430/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3430/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3430/events","html_url":"https://github.com/Particular/NServiceBus/issues/3430","id":131971014,"number":3430,"title":"Setting static outgoing headers causes an InvalidOperationException when sending in parallel","user":{"login":"hmemcpy","id":601206,"avatar_url":"https://avatars.githubusercontent.com/u/601206?v=3","gravatar_id":"","url":"https://api.github.com/users/hmemcpy","html_url":"https://github.com/hmemcpy","followers_url":"https://api.github.com/users/hmemcpy/followers","following_url":"https://api.github.com/users/hmemcpy/following{/other_user}","gists_url":"https://api.github.com/users/hmemcpy/gists{/gist_id}","starred_url":"https://api.github.com/users/hmemcpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmemcpy/subscriptions","organizations_url":"https://api.github.com/users/hmemcpy/orgs","repos_url":"https://api.github.com/users/hmemcpy/repos","events_url":"https://api.github.com/users/hmemcpy/events{/privacy}","received_events_url":"https://api.github.com/users/hmemcpy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-07T14:10:05Z","updated_at":"2016-02-07T22:22:10Z","closed_at":null,"body":"Recently, we released a hotfix for #3091 that fixed a race condition in RijndaelEncryptionService, however this introduced another bug in versions 4.7.10+ and 3.3 - an `InvalidOperationException: Collection was modified; enumeration operation may not execute` is thrown when the `UnicastBus.OutgoingHeaders` is iterated, while another thread sets the outgoing headers.\r\n\r\nWhile sending in parallel is not a thread-safe scenario per our documentation, this does not happen in v5 since a similar issue was fixed in #1976 by making the Dictionary backing the `OutgoingHeaders` property into a ConcurrentDictionary.\r\n\r\nCurrently, this issue causes PerformanceTests under versions 4.7.x and 3.3 to [fail with this error](http://builds.particular.net/viewLog.html?buildId=143555&tab=buildResultsDiv&buildTypeId=ProductionStagingTests_PerformanceTests). Is there a reason not to apply the same fix to 4.7 (i.e. making the dictionary into a ConcurrentDictionary)?\r\n\r\n@johnsimons @ramonsmits @SimonCropp, your input please?\r\n"},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/181134109","html_url":"https://github.com/Particular/NServiceBus/issues/3430#issuecomment-181134109","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3430","id":181134109,"user":{"login":"johnsimons","id":122651,"avatar_url":"https://avatars.githubusercontent.com/u/122651?v=3","gravatar_id":"","url":"https://api.github.com/users/johnsimons","html_url":"https://github.com/johnsimons","followers_url":"https://api.github.com/users/johnsimons/followers","following_url":"https://api.github.com/users/johnsimons/following{/other_user}","gists_url":"https://api.github.com/users/johnsimons/gists{/gist_id}","starred_url":"https://api.github.com/users/johnsimons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnsimons/subscriptions","organizations_url":"https://api.github.com/users/johnsimons/orgs","repos_url":"https://api.github.com/users/johnsimons/repos","events_url":"https://api.github.com/users/johnsimons/events{/privacy}","received_events_url":"https://api.github.com/users/johnsimons/received_events","type":"User","site_admin":false},"created_at":"2016-02-07T22:22:10Z","updated_at":"2016-02-07T22:22:10Z","body":"> Is there a reason not to apply the same fix to 4.7 (i.e. making the dictionary into a ConcurrentDictionary)?\r\n\r\nNope"}}