[Mono-list] Process.GetCurrentProcess().MainModule

Michael Foord fuzzyman at gmail.com
Wed Jan 21 11:18:51 EST 2009


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090121/d9675be9/attachment.html 


More information about the Mono-list mailing list