MarkOperationResult Enumeration

 

CommentMarkAtProfile, CommentMarkProfile, and MarkProfile return success or failure using the MarkOperationResult enum.

Namespace:   Microsoft.VisualStudio.Profiler
Assembly:  Microsoft.VisualStudio.Profiler (in Microsoft.VisualStudio.Profiler.dll)

Syntax

public enum MarkOperationResult
public enum class MarkOperationResult
type MarkOperationResult
Public Enumeration MarkOperationResult

Members

Member name Description
ErrorMarkerReserved

The parameter is less than or equal to 0. These values are reserved. The mark and comment are not recorded.

ErrorModeNever

The profiling mode was set to NEVER when the function was called. The mark and comment are not recorded.

ErrorModeOff

The global profiling level was set to OFF when the function was called. The mark and comment are not recorded.

ErrorNoSupport

No mark support in this context. The mark and comment are not recorded.

ErrorOutOfMemory

Memory was not available to record the event. The mark and comment are not recorded.

ErrorTextTooLong

The string exceeds the maximum of 256 characters. The comment string is truncated and the mark and comment are recorded.

OK

The call was successful.

Examples

These examples illustrate the MarkOperationResult enumeration.

The first example illustrates the ErrorModeReserved value.

public void ExerciseMarkOperationResult()
{
    // Declare enumeration to hold return value of 
    // call to MarkProfile.
    MarkOperationResult result;

    // Force MarkProfile to return a value that says an error
    // occurred.  In this case, MarkProfile should be passed 
    // a value greater than or equal to zero.  Passing in 
    // a -1 should return a value that indicates that the 
    // passed in parameter was less than or equal to zero.
    result = DataCollection.MarkProfile(-1);
    if (result == MarkOperationResult.ErrorMarkerReserved)
    {
        Console.WriteLine("Valid Result: Input was -1 and MarkProfile returned {0}", result);
    }
    else
    {
        Console.WriteLine("Invalid Result: MarkProfile Returned code {0} with input {1}", result.ToString(), -1);
    }
}

The second example illustrates the MarkOperationResult enumeration to hold the return value of a call to the CommentMarkProfile method.

public void ExerciseMarkOperationResult()
{
    // Declare and initialize variables to pass to
    // CommentMarkProfile.  The values of these 
    // parameters are assigned based on the needs 
    // of the code; and for the sake of simplicity 
    // in this example, the variables are assigned 
    // arbitrary values.
    int markId = 02;
    string markText = "Exercising CommentMarkProfile...";

    // Declare enumeration to hold return value of 
    // call to CommentMarkProfile.
    MarkOperationResult markResult;

    markResult = DataCollection.CommentMarkProfile(
        markId,
        markText);

    Console.WriteLine("CommentMarkProfile returned {0}",
        markResult);
}

See Also

Microsoft.VisualStudio.Profiler Namespace

Return to top