Description
#73803 (7.0) introduced a race condition when recreating the internal Regex
list.
The issue is that we update the IsChanged
flag before we replace the _regexBypassList
field here.
If two threads query GetProxy
or IsBypassed
at the same time, one may not observe changes to the bypass list and return the wrong answer.
var proxy = new WebProxy("myProxy:1234");
proxy.BypassArrayList.Add("contoso");
var task1 = Task.Run(() => proxy.IsBypassed(new Uri("http://contoso")));
var task2 = Task.Run(() => proxy.IsBypassed(new Uri("http://contoso")));
if (await task1 != await task2)
{
Console.WriteLine("Oh no");
}
This is limited to cases where the user modified the bypass list via the BypassArrayList
property, which is hopefully rare.