[Mono-list] Mono not catching this, VS does

Andres G. Aragoneses knocte at gmail.com
Fri Nov 4 10:26:01 EDT 2011


Please file a bug report in http://bugzilla.xamarin.com/

On 11/04/2011 02:02 PM, Matt Calder wrote:
> I don't know whether to call this a bug, but this code can result in an
> access of the List list, without assigning to it (in the case b is false):
>
>          public static void Foo(bool b)
>          {
>              int i;
>              List<int> list;
>              if (b && !dict.TryGetValue("foo", out list)) {
>                  dict["foo"] = new List<int>();
>              } else {
>                  i = list[0];
>              }
>
>          }
>
> Visual studio flags this as a compiler error. I am using:
>
> $ mono --version
> Mono JIT compiler version 2.11 ((no/7917753 Wed Mar 30 15:47:09 EDT 2011)
> Copyright (C) 2002-2011 Novell, Inc and Contributors.
> www.mono-project.com <http://www.mono-project.com>
>      TLS:           __thread
>      SIGSEGV:       altstack
>      Notifications: epoll
>      Architecture:  amd64
>      Disabled:      none
>      Misc:          softdebug
>      LLVM:          yes(2.8svn-mono)
>      GC:            Included Boehm (with typed GC and Parallel Mark)
>
>




More information about the Mono-list mailing list