Bug 9983 - Host exception list for Proxy does rise exception
Summary: Host exception list for Proxy does rise exception
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2013-02-01 11:43 UTC by Elmar Haneke
Modified: 2017-10-12 13:20 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Elmar Haneke 2013-02-01 11:43:31 UTC
When the list of hosts not serviced by proxy does contain something like "*.bwl.*" WebRequest.GetSystemWebProxy() does raise an error.

System.ArgumentException: parsing "*.bwl.*" - Bad quantifier.
Parameter name: *.bwl.*
  at System.Text.RegularExpressions.Syntax.Parser.ParseGroup (System.Text.RegularExpressions.Syntax.Group group, RegexOptions options, System.Text.RegularExpressions.Syntax.Assertion assertion) [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Syntax.Parser.ParseRegularExpression (System.String pattern, RegexOptions options) [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Regex.CreateMachineFactory (System.String pattern, RegexOptions options) [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Regex.InitNewRegex () [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Regex.Init () [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Regex..ctor (System.String pattern, RegexOptions options) [0x00000] in <filename unknown>:0
  at System.Text.RegularExpressions.Regex..ctor (System.String pattern) [0x00000] in <filename unknown>:0
  at System.Net.WebProxy.CheckBypassList () [0x00000] in <filename unknown>:0
  at System.Net.WebProxy..ctor (System.Uri address, Boolean bypassOnLocal, System.String[] bypassList, ICredentials credentials) [0x00000] in <filename unknown>:0
  at System.Net.WebProxy..ctor (System.String address, Boolean bypassOnLocal, System.String[] bypassList) [0x00000] in <filename unknown>:0
  at System.Net.WebRequest.GetSystemWebProxy () [0x00000] in <filename unknown>:0
  at Test.Main (System.String[] args) [0x00000] in <filename unknown>:0

The Error does happen in mono 3.0.3, it does not happen in mono 2.10.8
Comment 1 Dmitry Azaraev 2013-05-16 10:51:47 UTC
I got exactly same on mono 3.0.10 (windows).
Comment 2 Marek Safar 2016-05-30 09:02:17 UTC
I get same result on .net

        Uri proxy1 = new Uri("http://proxy.contoso.com");
        WebProxy p = new WebProxy(proxy1, true);
        p.BypassList = new[] { "*.bwl.*" };


System.ArgumentException: parsing "*.bwl.*" - Quantifier {x,y} following nothing.
   at System.Text.RegularExpressions.RegexParser.ScanRegex()
   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options)
   at System.Net.WebProxy.UpdateRegExList(Boolean canThrow)
   at System.Net.WebProxy.set_BypassList(String[] value)
Comment 3 Elmar Haneke 2016-06-01 08:37:30 UTC
For an BypasList directly passed in code the Exception is expected bahaviour since the strings have to be in regex syntax.

The Problem is that the incorrect bypass list is read from System-Configuration - at this point the data should be checked to ignore syntactical incorrect items.
Comment 4 Marek Safar 2016-06-01 08:39:49 UTC
I tried to guess from your description what scenario you used. Please provide comprehensive test case if you are using it differently
Comment 5 Elmar Haneke 2016-06-02 08:48:16 UTC
Steps to Reproduce:
- Open Ineternet-Explorer
- add "*.bwl.*" to proxy bypass list
- Compile and Run
  using System.Net;

  class Test {

	public static void Main (string[] args) {
		var px=WebRequest.GetSystemWebProxy();

Running on Dot net does not rise an Exception, running with mono does. WebAcces within IE does still work.
Comment 6 Marek Safar 2017-10-12 13:20:41 UTC
I still could not reproduce the issue on Mac. Does this happen on Windows only ?

Note You need to log in before you can comment on or make changes to this bug.