Export (0) Print
Expand All

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)

public enum MarkOperationResult
public enum MarkOperationResult
public enum MarkOperationResult

 Member nameDescription
ErrorMarkerReservedThe parameter is less than or equal to 0. These values are reserved. The mark and comment are not recorded. 
ErrorModeNeverThe profiling mode was set to NEVER when the function was called. The mark and comment are not recorded. 
ErrorModeOffThe global profiling level was set to OFF when the function was called. The mark and comment are not recorded. 
ErrorNoSupportNo mark support in this context. The mark and comment are not recorded. 
ErrorOutOfMemoryMemory was not available to record the event. The mark and comment are not recorded. 
ErrorTextTooLongThe string exceeds the maximum of 256 characters. The comment string is truncated and the mark and comment are recorded. 
OKThe call was successful. 

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);
        }

Community Additions

ADD
Show:
© 2014 Microsoft