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 ()
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: 2018-03-13 11:07 UTC (History)
3 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

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 ?
Comment 7 Marek Safar 2018-03-13 11:07:33 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.

Thank you!