<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt">I have been trying to create a mutex access rule to add to a mutex security object.&nbsp; 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'.<br><br><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; string user;</span><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;MutexSecurity ms = new MutexSecurity();</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &nbsp;</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//First create the username that we will use in the mutex security</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//rules.</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;user = System.Environment.UserDomainName + "\\" + System.Environment.UserName;</span><br style="font-style:
 italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//Now create the mutex access rules and add them to the security object.</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;MutexAccessRule mar1 = new MutexAccessRule(</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;user, MutexRights.ReadPermissions, AccessControlType.Allow);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ms.AddAccessRule(mar1);</span><br style="font-style: italic;">&nbsp;&nbsp; &nbsp; <br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <br>The trace for the exception is as follows:<br><br><br>Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of range.<br>&nbsp; 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 <br>&nbsp; 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 <br>&nbsp; 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 <br>&nbsp; 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 <br><br><br>Is the above a problem with my code, or a problem with mono ?<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><div style="color: rgb(0, 0, 0);">Brett Senior.</div><div><br></div></div><br>



      <hr size=1>
Win a MacBook Air or iPod touch with Yahoo!7- <a href="http://au.rd.yahoo.com/mail/taglines/au/y7mail/default/hpset/*http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline">Find out more</a>.</body></html>