Dispose() public method

public Dispose ( ) : void
return void
Ejemplo n.º 1
0
        /*
         *
         * Don't add any P/Invokes here.
         *
         * Add annotations (@GeneratePInvoke) to your C/C++ methods to generate the P/Invokes.
         * If the generator gets parameters wrong, you can add a @MarshalAs=<whatever> to override.
         *
         */
        internal static Exception CreateManagedException(MoonError err)
        {
            string    msg = err.Message;
            Exception ex  = null;

            if (err.GCHandle.IsAllocated)
            {
                // We need to get this before calling Dispose.
                ex = err.GCHandle.Target as Exception;
            }

            err.Dispose();

            switch (err.Number)
            {
            case 1:
            default:
                return(new Exception(msg));

            case 2:
                return(new ArgumentException(msg));

            case 3:
                return(new ArgumentNullException(msg));

            case 4:
                return(new ArgumentOutOfRangeException(msg));

            case 5:
                return(new InvalidOperationException(msg));

            case 6:
                return(new XamlParseException(err.LineNumber, err.CharPosition, msg));

            case 7:
                return(new UnauthorizedAccessException(msg));

            case 8:
                return(new ExecutionEngineException(msg));

            case 9:
                if (ex != null)
                {
                    return(ex);
                }
                return(new Exception(msg));

            case 10:
                return(new ListenFailedException(msg));

            case 11:
                return(new SendFailedException(msg));

            case 12:
                return(new NotImplementedException(msg));

            case 13:
                return(new SecurityException(msg));

            case 14:
                return(new NotSupportedException(msg));
            }
        }
Ejemplo n.º 2
0
		/*
		 * 
		 * Don't add any P/Invokes here.
		 * 
		 * Add annotations (@GeneratePInvoke) to your C/C++ methods to generate the P/Invokes.
		 * If the generator gets parameters wrong, you can add a @MarshalAs=<whatever> to override.
		 * 
		 */
		internal static Exception CreateManagedException (MoonError err)
		{
			string msg = err.Message;
			Exception ex = null;
			
			if (err.GCHandle.IsAllocated) {
				// We need to get this before calling Dispose.
				ex = err.GCHandle.Target as Exception;
			}

			err.Dispose ();
			
			switch (err.Number) {
			case 1:
			default:
				return new Exception (msg);
			case 2:
				return new ArgumentException (msg);
			case 3:
				return new ArgumentNullException (msg);
			case 4:
				return new ArgumentOutOfRangeException (msg);
			case 5:
				return new InvalidOperationException (msg);
			case 6:
				return new XamlParseException (err.LineNumber, err.CharPosition, msg);
			case 7:
				return new UnauthorizedAccessException (msg);
			case 8:
				return new ExecutionEngineException (msg);
			case 9:
				if (ex != null)
					return ex;
				return new Exception (msg);
			case 10:
				return new ListenFailedException (msg);
			case 11:
				return new SendFailedException (msg);
			case 12:
				return new NotImplementedException (msg);
			case 13:
				return new SecurityException (msg);
			case 14:
				return new NotSupportedException (msg);
			}
		}