C# 클래스 Microsoft.Scripting.Runtime.LightExceptions

Provides support for light exceptions. These exceptions are propagated by returning an instance of a private wrapper class containing the exception. Code which is aware of light exceptions will branch to apporiate exception handling blocks when in a try and otherwise return the value up the stack. This avoids using the underlying CLR exception mechanism with overhead such as creating stack traces. When a light exception reaches the boundary of code which is not light exception aware the caller must check to see if a light exception is being thrown and if so raise a .NET exception. This class provides methods for re-writing expression trees to support light exceptions, methods to create light throw objects, check if an object is a light throw object, and turn such an object back into a .NET Exception which can be thrown. Light exceptions also don't build up stack traces or interoperate with filter blocks via 2-pass exception handling.
파일 보기 프로젝트 열기: jschementi/iron

공개 메소드들

메소드 설명
CheckAndThrow ( Expression expr ) : Expression

Wraps the expression in a check and rethrow.

CheckAndThrow ( object value ) : object

Throws the exception if the value represents a light exception

GetLightException ( object exceptionValue ) : Exception

Gets the light exception from an object which may contain a light exception. Returns null if the object is not a light exception. Used for throwing the exception at non-light exception boundaries.

IsLightException ( object value ) : bool

Checks to see if the provided value is a light exception.

Rewrite ( Expression expression ) : Expression

Rewrites the provided expression to support light exceptions. Calls to the returned expression, if not from other light-weight aware calls, need to call GetLightException on return to see if an exception was thrown and if so throw it.

RewriteExternal ( Expression expression ) : Expression

Returns a new expression which is re-written for light exceptions but will throw an exception if it escapes the expression. If this expression is part of a larger experssion which is later re-written for light exceptions then it will propagate the light exception up.

RewriteLazy ( Expression expression ) : Expression

Returns a new expression which will lazily reduce to a light expression re-written version of the same expression.

SupportsLightThrow ( this binder ) : bool

Returns true if the call site binder is a light exception binder and supports light throws. Returns false otherwise.

Throw ( Expression exceptionValue ) : Expression

Returns an object which represents a light exception.

Throw ( Expression exceptionValue, Type retType ) : Expression

Returns an object which represents a light exception.

Throw ( this binder, Expression exceptionValue ) : Expression

If the binder supports light exceptions then a light exception throwing expression is returned. Otherwise a normal throwing expression is returned.

Throw ( this binder, Expression exceptionValue, Type retType ) : Expression

If the binder supports light exceptions then a light exception throwing expression is returned. Otherwise a normal throwing expression is returned.

Throw ( Exception exceptionValue ) : object

Returns an object which represents a light exception.

비공개 메소드들

메소드 설명
ThrowException ( LightException lightEx ) : void
ToReadOnly ( Expression args ) : ReadOnlyCollection

메소드 상세

CheckAndThrow() 공개 정적인 메소드

Wraps the expression in a check and rethrow.
public static CheckAndThrow ( Expression expr ) : Expression
expr Expression
리턴 Expression

CheckAndThrow() 공개 정적인 메소드

Throws the exception if the value represents a light exception
public static CheckAndThrow ( object value ) : object
value object
리턴 object

GetLightException() 공개 정적인 메소드

Gets the light exception from an object which may contain a light exception. Returns null if the object is not a light exception. Used for throwing the exception at non-light exception boundaries.
public static GetLightException ( object exceptionValue ) : Exception
exceptionValue object
리턴 System.Exception

IsLightException() 공개 정적인 메소드

Checks to see if the provided value is a light exception.
public static IsLightException ( object value ) : bool
value object
리턴 bool

Rewrite() 공개 정적인 메소드

Rewrites the provided expression to support light exceptions. Calls to the returned expression, if not from other light-weight aware calls, need to call GetLightException on return to see if an exception was thrown and if so throw it.
public static Rewrite ( Expression expression ) : Expression
expression Expression
리턴 Expression

RewriteExternal() 공개 정적인 메소드

Returns a new expression which is re-written for light exceptions but will throw an exception if it escapes the expression. If this expression is part of a larger experssion which is later re-written for light exceptions then it will propagate the light exception up.
public static RewriteExternal ( Expression expression ) : Expression
expression Expression
리턴 Expression

RewriteLazy() 공개 정적인 메소드

Returns a new expression which will lazily reduce to a light expression re-written version of the same expression.
public static RewriteLazy ( Expression expression ) : Expression
expression Expression
리턴 Expression

SupportsLightThrow() 공개 정적인 메소드

Returns true if the call site binder is a light exception binder and supports light throws. Returns false otherwise.
public static SupportsLightThrow ( this binder ) : bool
binder this
리턴 bool

Throw() 공개 정적인 메소드

Returns an object which represents a light exception.
public static Throw ( Expression exceptionValue ) : Expression
exceptionValue Expression
리턴 Expression

Throw() 공개 정적인 메소드

Returns an object which represents a light exception.
public static Throw ( Expression exceptionValue, Type retType ) : Expression
exceptionValue Expression
retType System.Type
리턴 Expression

Throw() 공개 정적인 메소드

If the binder supports light exceptions then a light exception throwing expression is returned. Otherwise a normal throwing expression is returned.
public static Throw ( this binder, Expression exceptionValue ) : Expression
binder this
exceptionValue Expression
리턴 Expression

Throw() 공개 정적인 메소드

If the binder supports light exceptions then a light exception throwing expression is returned. Otherwise a normal throwing expression is returned.
public static Throw ( this binder, Expression exceptionValue, Type retType ) : Expression
binder this
exceptionValue Expression
retType System.Type
리턴 Expression

Throw() 공개 정적인 메소드

Returns an object which represents a light exception.
public static Throw ( Exception exceptionValue ) : object
exceptionValue System.Exception
리턴 object