Open sandboxFocus

Class ThreadAccessException

Exception thrown when the calling thread does not have access to the object.

Inheritance
ThreadAccessException
Implements
Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading.dll
Syntax
public class ThreadAccessException : ThreadingException, ISerializable
Remarks

This exception is raised when the calling thread accesses the object without going through a public method.

For the ReaderWriterSynchronizedThreadingModel, the exception may mean that a public method was not annotated with an access custom attribute (ReaderAttribute, WriterAttribute and others).

The exception is thrown by the SynchronizedAttribute, ReaderWriterSynchronizedAttribute and ThreadUnsafeAttribute threading models when run-time verification is enabled. A typical cause is a private method invoked as a callback, for instance an event handler; add the EntryPointAttribute custom attribute to such methods.

Constructors

Name Description
ThreadAccessException()

Initializes a new instance of the ThreadAccessException class with the default error message.

ThreadAccessException(SerializationInfo, StreamingContext)

Initializes a new instance of the ThreadAccessException class with serialized data.

ThreadAccessException(string)

Initializes a new instance of the ThreadAccessException class with a given error message.

ThreadAccessException(string, Exception)

Initializes a new instance of the ThreadAccessException class with a given error message and inner exception.

See Also