which is only thrown for one user.What should you do to stop the exception from being thrown?

You are using the Semaphore class to synchronize access to a resource pool. During an inspection you find out that an exception of type UnauthorizedAccessException is thrown when you call the OpenExisting method of the Semaphore class, which is only thrown for one user.
What should you do to stop the exception from being thrown?

You are using the Semaphore class to synchronize access to a resource pool. During an inspection you find out that an exception of type UnauthorizedAccessException is thrown when you call the OpenExisting method of the Semaphore class, which is only thrown for one user.
What should you do to stop the exception from being thrown?

A.
You should call the Demand method of an unrestricted SecurityPermission instance.

B.
You should grant the user permission to read the semaphore that protects the resource pool.

C.
You should grant the user permission to access the resource pool.

D.
You should call the Assert method of an unrestricted SecurityPermission instance.

Explanation:
The user’s permissions are granted to read the semaphore that protects the resource pool. An access control list is there to protect the Semaphores. The SetAccessControl method of the Semaphore class is there to grant the users permissions to read the semaphore.
Incorrect Answers:
A: The Demand method is not used for an unrestricted SecurityPermission instance.
C: The user permission is not use to access the resource to correct the problem.
D: The SecurityPermission prevents a code from performing a stack walk past the present stack.



Leave a Reply 0

Your email address will not be published. Required fields are marked *