{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/5516","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/5516/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/5516/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/5516/events","html_url":"https://github.com/dotnet/corefx/issues/5516","id":127435737,"number":5516,"title":"Invalid lock in System.AppContext","user":{"login":"ViIvanov","id":795200,"avatar_url":"https://avatars.githubusercontent.com/u/795200?v=3","gravatar_id":"","url":"https://api.github.com/users/ViIvanov","html_url":"https://github.com/ViIvanov","followers_url":"https://api.github.com/users/ViIvanov/followers","following_url":"https://api.github.com/users/ViIvanov/following{/other_user}","gists_url":"https://api.github.com/users/ViIvanov/gists{/gist_id}","starred_url":"https://api.github.com/users/ViIvanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ViIvanov/subscriptions","organizations_url":"https://api.github.com/users/ViIvanov/orgs","repos_url":"https://api.github.com/users/ViIvanov/repos","events_url":"https://api.github.com/users/ViIvanov/events{/privacy}","received_events_url":"https://api.github.com/users/ViIvanov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-01-19T12:32:37Z","updated_at":"2016-01-19T15:46:27Z","closed_at":null,"body":"Look into https://github.com/dotnet/corefx/blob/c8fe92337de2f82d84ad98b18883c527752c09a0/src/System.AppContext/src/System/AppContext.cs#L58\r\n\r\n`s_switchMap` locked in `TryGetSwitch` method and `s_syncLock` in `SetSwitch`. Actually, access to the dictionary `s_switchMap` is not thread safe."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/172893357","html_url":"https://github.com/dotnet/corefx/issues/5516#issuecomment-172893357","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/5516","id":172893357,"user":{"login":"JonHanna","id":1253369,"avatar_url":"https://avatars.githubusercontent.com/u/1253369?v=3","gravatar_id":"","url":"https://api.github.com/users/JonHanna","html_url":"https://github.com/JonHanna","followers_url":"https://api.github.com/users/JonHanna/followers","following_url":"https://api.github.com/users/JonHanna/following{/other_user}","gists_url":"https://api.github.com/users/JonHanna/gists{/gist_id}","starred_url":"https://api.github.com/users/JonHanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonHanna/subscriptions","organizations_url":"https://api.github.com/users/JonHanna/orgs","repos_url":"https://api.github.com/users/JonHanna/repos","events_url":"https://api.github.com/users/JonHanna/events{/privacy}","received_events_url":"https://api.github.com/users/JonHanna/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T15:46:27Z","updated_at":"2016-01-19T15:46:27Z","body":"Yep. To make it survive you have to both grab some local copies of arrays in the finding methods (the `get` on the indexer and `TryGetValue`) and add at least one memory barrier to the Resize method."}}