示例#1
0
 public int GetUrl(
     int bufferLength, 
     out int count,
     [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out]char[] url)
 {
     string name = SymReader.MetadataReader.GetString(SymReader.MetadataReader.GetDocument(Handle).Name);
     return InteropUtilities.StringToBuffer(name, bufferLength, out count, url);
 }
示例#2
0
        public int GetName(
            int bufferLength,
            out int count,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] char[] name)
        {
            var variable = MetadataReader.GetLocalVariable(_handle);
            var str      = MetadataReader.GetString(variable.Name);

            return(InteropUtilities.StringToBuffer(str, bufferLength, out count, name));
        }
示例#3
0
        public int GetName(
            int bufferLength,
            out int count,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] char[] name)
        {
            var mdReader = _pdbReader.MetadataReader;
            var constant = mdReader.GetLocalConstant(_handle);

            var str = mdReader.GetString(constant.Name);

            return(InteropUtilities.StringToBuffer(str, bufferLength, out count, name));
        }
示例#4
0
        /// <summary>
        /// Get the file name for the line associated with specified offset.
        /// </summary>
        public int GetFileNameFromOffset(
            int offset,
            int bufferLength,
            out int count,
            [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] char[] name)
        {
            if (offset < 0)
            {
                offset = int.MaxValue;
            }

            var debugInfo = MetadataReader.GetMethodDebugInformation(DebugHandle);
            var candidate = debugInfo.Document;

            if (candidate.IsNil)
            {
                // method body spans multiple documents:
                foreach (var sp in GetSequencePoints())
                {
                    if (sp.Offset <= offset)
                    {
                        candidate = sp.Document;
                    }
                    else if (sp.Offset > offset)
                    {
                        break;
                    }
                }

                // offset is negative, or sequence point blob is missing document definition (bad metadata):
                if (candidate.IsNil)
                {
                    count = 0;
                    return(HResult.E_FAIL);
                }
            }

            var    document = MetadataReader.GetDocument(candidate);
            string nameStr  = MetadataReader.GetString(document.Name);

            return(InteropUtilities.StringToBuffer(nameStr, bufferLength, out count, name));
        }