[Mono-list] Regex Exception - Discrepancy between .NET and Mono

Jiří Zárevúcký zarevucky.jiri at gmail.com
Mon Feb 16 08:37:49 EST 2009


Hello. I guess you can file a bug, just for the sake of uniform
behavior. Although it probably won't cause trouble to anyone (at least
I can't imagine the scenario), fixing it should be ridiculously easy.

2009/2/16 Matt Lee <thatismatt at gmail.com>:
> Dear All,
> The simple class below throws an exception, but under .NET
> an ArgumentNullException is thrown, whereas under Mono
> a NullReferenceException is thrown.
> using System.Text.RegularExpressions;
> public class Program
> {
>     public static void Main(string[] args)
>     {
>         var r = new Regex("");
>         r.Match(null);
>     }
> }
> I spotted this because the stack trace contained line references that
> weren't on my machine:
> Unhandled Exception: System.NullReferenceException: Object reference not set
> to an instance of an object
>   at System.Text.RegularExpressions.Regex.Match (System.String input, Int32
> startat) [0x00000]
>     in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.2\mcs\build\common\Consts.cs:1
>   at System.Text.RegularExpressions.Regex.Match (System.String input)
> [0x00000]
>     in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.2\mcs\class\System\System.Text.RegularExpressions\Regex.cs:337
>   at Program.Main (System.String[] args) [0x00000]
> For reference the .NET stack trace is below:
> Unhandled Exception: System.ArgumentNullException: Value cannot be null.
> Parameter name: input
>    at System.Text.RegularExpressions.Regex.Match(String input)
>    at Program.Main(String[] args)
> Should I file a bug about this? Or do we not really!
> Thanks,
> Matt
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>


More information about the Mono-list mailing list