/// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.ToString"]/*' />
                /// <devdoc>
                ///     Converts this handle to a printable string.  the string consists
                ///     of the handle value along with the callstack for it's
                ///     allocation.
                /// </devdoc>
                public string ToString(HandleType type)
                {
                    StackParser sp = new StackParser(callStack);

                    // Discard all of the stack up to and including the "Handle.create" call
                    //
                    sp.DiscardTo("HandleCollector.Add");

                    // Skip the next call as it is always a debug wrapper
                    //
                    sp.DiscardNext();

                    // Now recreate the leak list with ten stack entries maximum, and
                    // put it all on one line.
                    //
                    sp.Truncate(10);

                    string description = "";

                    if (type.name.Equals("GDI") || type.name.Equals("HDC"))
                    {
                        int objectType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, handle));
                        switch (objectType)
                        {
                        case NativeMethods.OBJ_DC: description = "normal DC"; break;

                        case NativeMethods.OBJ_MEMDC: description = "memory DC"; break;

                        case NativeMethods.OBJ_METADC: description = "metafile DC"; break;

                        case NativeMethods.OBJ_ENHMETADC: description = "enhanced metafile DC"; break;

                        case NativeMethods.OBJ_PEN: description = "Pen"; break;

                        case NativeMethods.OBJ_BRUSH: description = "Brush"; break;

                        case NativeMethods.OBJ_PAL: description = "Palette"; break;

                        case NativeMethods.OBJ_FONT: description = "Font"; break;

                        case NativeMethods.OBJ_BITMAP: description = "Bitmap"; break;

                        case NativeMethods.OBJ_REGION: description = "Region"; break;

                        case NativeMethods.OBJ_METAFILE: description = "Metafile"; break;

                        case NativeMethods.OBJ_EXTPEN: description = "Extpen"; break;

                        default: description = "?"; break;
                        }
                        description = " (" + description + ")";
                    }

                    return(Convert.ToString((int)handle, 16) + description + ": " + sp.ToString());
                }
Exemple #2
0
                public string ToString(System.Internal.DebugHandleTracker.HandleType type)
                {
                    StackParser parser = new StackParser(this.callStack);

                    parser.DiscardTo("HandleCollector.Add");
                    parser.DiscardNext();
                    parser.Truncate(40);
                    string str = "";

                    return(Convert.ToString((int)this.handle, 0x10) + str + ": " + parser.ToString());
                }
                public string ToString(HandleType type)
                {
                    StackParser stackParser = new StackParser(callStack);

                    stackParser.DiscardTo("HandleCollector.Add");
                    stackParser.DiscardNext();
                    stackParser.Truncate(40);
                    string str = "";

                    return(Convert.ToString((int)handle, 16) + str + ": " + stackParser.ToString());
                }
Exemple #4
0
                /// <summary>
                /// Converts this handle to a printable string.  the string consists of the handle value along with
                /// the callstack for it's allocation.
                /// </summary>
                public string ToString(HandleType type)
                {
                    StackParser sp = new StackParser(callStack);

                    // Discard all of the stack up to and including the "Handle.create" call
                    sp.DiscardTo("HandleCollector.Add");

                    // Skip the next call as it is always a debug wrapper
                    sp.DiscardNext();

                    // Now recreate the leak list with a lot of stack entries
                    sp.Truncate(40);

                    string description = "";

                    return(Convert.ToString(unchecked ((int)handle), 16) + description + ": " + sp.ToString());
                }
                /// <include file='doc\DebugHandleTracker.uex' path='docs/doc[@for="DebugHandleTracker.HandleType.HandleEntry.ToString"]/*' />
                /// <devdoc>
                ///     Converts this handle to a printable string.  the string consists
                ///     of the handle value along with the callstack for it's
                ///     allocation.
                /// </devdoc>
                public string ToString(HandleType type) {
                    StackParser sp = new StackParser(callStack);

                    // Discard all of the stack up to and including the "Handle.create" call
                    //
                    sp.DiscardTo("HandleCollector.Add");

                    // Skip the next call as it is always a debug wrapper
                    //
                    sp.DiscardNext();

                    // Now recreate the leak list with a lot of stack entries
                    //
                    sp.Truncate(40);

                    string description = "";
                    /*if (type.name.Equals("GDI") || type.name.Equals("HDC")) {
                        int objectType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, handle));
                        switch (objectType) {
                            case NativeMethods.OBJ_DC: description = "normal DC"; break;
                            case NativeMethods.OBJ_MEMDC: description = "memory DC"; break;
                            case NativeMethods.OBJ_METADC: description = "metafile DC"; break;
                            case NativeMethods.OBJ_ENHMETADC: description = "enhanced metafile DC"; break;

                            case NativeMethods.OBJ_PEN: description = "Pen"; break;
                            case NativeMethods.OBJ_BRUSH: description = "Brush"; break;
                            case NativeMethods.OBJ_PAL: description = "Palette"; break;
                            case NativeMethods.OBJ_FONT: description = "Font"; break;
                            case NativeMethods.OBJ_BITMAP: description = "Bitmap"; break;
                            case NativeMethods.OBJ_REGION: description = "Region"; break;
                            case NativeMethods.OBJ_METAFILE: description = "Metafile"; break;
                            case NativeMethods.OBJ_EXTPEN: description = "Extpen"; break;
                            default: description = "?"; break;
                        }
                        description = " (" + description + ")";
                    }*/

                    return Convert.ToString(unchecked((int)handle), 16) + description + ": " + sp.ToString();
                }
 public string ToString(DebugHandleTracker.HandleType type)
 {
     StackParser parser = new StackParser(this.callStack);
     parser.DiscardTo("HandleCollector.Add");
     parser.DiscardNext();
     parser.Truncate(40);
     string str = "";
     return (Convert.ToString((int) this.handle, 0x10) + str + ": " + parser.ToString());
 }