This is a bug that has been fixed in SVN and will be in 2.4

-g

On Wed, 2009-01-21 at 16:18 +0000, Michael Foord wrote:
> Hello all,
> 
> I'm using Mono 2.2 on Mac OS X. I get an exception when trying to use
> Process.GetCurrentProcess().MainModule
> 
> Unhandled Exception: System.ArgumentOutOfRangeException: Index is less
> than 0 or more than or equal to the list count.
> Parameter name: index
> 0
>   at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException
> (System.String name, System.Object actual, System.String message)
> [0x00000]
> in 
> /private/tmp/monobuild/build/BUILD/mono-2.2/mcs/class/corlib/System.Collections/ArrayList.cs:3258
>  
>   at System.Collections.ArrayList.get_Item (Int32 index) [0x00013]
> in 
> /private/tmp/monobuild/build/BUILD/mono-2.2/mcs/class/corlib/System.Collections/ArrayList.cs:2649
>  
>   at System.Diagnostics.ProcessModuleCollection.get_Item (Int32 index)
> [0x00000]
> in 
> /private/tmp/monobuild/build/BUILD/mono-2.2/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs:63
>  
>   at System.Diagnostics.Process.get_MainModule () [0x00000]
> in 
> /private/tmp/monobuild/build/BUILD/mono-2.2/mcs/class/System/System.Diagnostics/Process.cs:232
>  
>   at (wrapper remoting-invoke-with-check)
> System.Diagnostics.Process:get_MainModule ()
>   at process.MainClass.Main (System.String[] args) [0x00000]
> in /Users/michael/Dev/Projects/process/process/Main.cs:15 
> 
> 
> I get this with the following code compiled with MonoDevelop (and also
> IronPython where I was actually trying to use it):
> 
> using System;
> using System.Diagnostics;
> 
> namespace process
> {
>     class MainClass
>     {
>         public static void Main(string[] args)
>         {
>             Console.WriteLine(Process.GetCurrentProcess().MainModule);
>         }
>     }
> }
> 
> All the best,
> 
> Michael Foord
> 
> -- 
> http://www.ironpythoninaction.com/
> 
> 
> _______________________________________________
> Mono-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to