Open sandboxFocus

Class MessageLocation

Represents the location of a message. For the end user, it is a line in a source code file. For the aspect developer, the location can be an object that represents an element of code (for example, a Type or MethodInfo). PostSharp resolves such implicit locations to a file and line number.

Inheritance
MessageLocation
Namespace: PostSharp.Extensibility
Assembly: PostSharp.dll
Syntax
public class MessageLocation
Remarks

Always give a relevant location to the messages you emit. Besides pointing the user to the source code, the location determines whether a SuppressWarningAttribute applies: PostSharp looks for this attribute on the element of code of the location and on its enclosing declarations.

Fields

Name Description
Unknown

Represents an unknown or indeterminate location of the error message.

Properties

Name Description
CodeElement

Gets the element of code (reflection object or Declaration) from which the location must be resolved.

EndColumn

Gets the ending column in the file that caused the message.

EndLine

Gets the ending line in the file that caused the message.

File

Gets the name of the file that caused the message.

StartColumn

Gets the starting column in the file that caused the message.

StartLine

Gets the starting line in the file that caused the message.

Methods

Name Description
Explicit(string)

Builds a MessageLocation explicitly by specifying only a file name.

Explicit(string, int, int)

Builds a MessageLocation explicitly by specifying a file name, line and column.

Explicit(string, int, int, int, int)

Builds a MessageLocation explicitly by specifying a file name, line and column.

Of(LocationInfo)

Builds a MessageLocation from a LocationInfo.

Of(IExpression)

Builds a MessageLocation from an IExpression.

Of(SymbolSequencePoint)

Builds a MessageLocation from a SymbolSequencePoint.

Of(object)

Builds a MessageLocation from an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, IExpression, Assembly, ParameterInfo, EventInfo, PropertyInfo or, if you are using PostSharp SDK, any Declaration).

Of(Assembly)

Builds a MessageLocation from an Assembly.

Of(MemberInfo)

Builds a MessageLocation from a MemberInfo (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).

Of(ParameterInfo)

Builds a MessageLocation from a ParameterInfo.

See Also