[Pkg-mono-devel] Out Of Range exception when defining a mutex access rule

Brett Senior brett_senior at yahoo.com.au
Sun Aug 17 11:26:35 UTC 2008


I have been trying to create a mutex access rule to add to a mutex security object.  When I execute the following code I get an 'Out of Range' exception that indicates a problem with the line that defines the mutex access rule 'mar1'.

                string user;                
                MutexSecurity ms = new MutexSecurity();
                
                //
                //First create the username that we will use in the mutex security
                //rules.
                //
                user = System.Environment.UserDomainName + "\\" + System.Environment.UserName;
                
                //
                //Now create the mutex access rules and add them to the security object.
                //
                MutexAccessRule mar1 = new MutexAccessRule(
                    user, MutexRights.ReadPermissions, AccessControlType.Allow);
                    
                ms.AddAccessRule(mar1);
     
           
The trace for the exception is as follows:


Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of range.
  at System.Security.AccessControl.AuthorizationRule..ctor (System.Security.Principal.IdentityReference identity, Int32 accessMask, Boolean isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) [0x0004d] in /home/ingo/mono-1.9.1+dfsg/mcs/class/corlib/System.Security.AccessControl/AuthorizationRule.cs:69 
  at System.Security.AccessControl.AccessRule..ctor (System.Security.Principal.IdentityReference identity, Int32 accessMask, Boolean isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) [0x00000] in /home/ingo/mono-1.9.1+dfsg/mcs/class/corlib/System.Security.AccessControl/AccessRule.cs:44 
  at System.Security.AccessControl.MutexAccessRule..ctor (System.Security.Principal.IdentityReference identity, MutexRights mutexRights, AccessControlType type) [0x00000] in /home/ingo/mono-1.9.1+dfsg/mcs/class/corlib/System.Security.AccessControl/MutexAccessRule.cs:44 
  at System.Security.AccessControl.MutexAccessRule..ctor (System.String identity, MutexRights mutexRights, AccessControlType type) [0x00000] in /home/ingo/mono-1.9.1+dfsg/mcs/class/corlib/System.Security.AccessControl/MutexAccessRule.cs:52 


Is the above a problem with my code, or a problem with mono ?
       

Brett Senior.



      Win a MacBook Air or iPod touch with Yahoo!7. http://au.docs.yahoo.com/homepageset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/pkg-mono-devel/attachments/20080817/2539bd33/attachment.htm 


More information about the Pkg-mono-devel mailing list