diff --git a/Build/Build.fsproj b/Build/Build.fsproj index f8bfdff..817c420 100644 --- a/Build/Build.fsproj +++ b/Build/Build.fsproj @@ -42,59 +42,6 @@ - - - True - - - - - - - - - - - - - - - - - - Always - - - Always - - - - - - - Git - {726a13b9-f319-40fa-aef6-fe629cfdaf6a} - True - - - SourceLink - {aaf1b8d7-791e-40f1-a278-9a16d9667866} - True - - - - 11 - - - - -if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries" -if not exist "$(TargetDir)NativeBinaries\x86" md "$(TargetDir)NativeBinaries\x86" -xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86" -if not exist "$(TargetDir)NativeBinaries\amd64" md "$(TargetDir)NativeBinaries\amd64" -xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64" - - @@ -172,4 +119,57 @@ xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd + + + True + + + + + + + + + + + + + + + + + + Always + + + Always + + + + + + + Git + {726a13b9-f319-40fa-aef6-fe629cfdaf6a} + True + + + SourceLink + {aaf1b8d7-791e-40f1-a278-9a16d9667866} + True + + + + 11 + + + + +if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries" +if not exist "$(TargetDir)NativeBinaries\x86" md "$(TargetDir)NativeBinaries\x86" +xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86" +if not exist "$(TargetDir)NativeBinaries\amd64" md "$(TargetDir)NativeBinaries\amd64" +xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64" + + \ No newline at end of file diff --git a/ConsoleTest/ConsoleTest.fsproj b/ConsoleTest/ConsoleTest.fsproj index 8bc7468..32440b5 100644 --- a/ConsoleTest/ConsoleTest.fsproj +++ b/ConsoleTest/ConsoleTest.fsproj @@ -39,59 +39,6 @@ false - - - True - - - - - - - - - - - - - - - - - - - - - - - Git - {726a13b9-f319-40fa-aef6-fe629cfdaf6a} - True - - - Pe - {12331d73-8eb9-4a60-9079-00d26b71a04b} - True - - - SourceLink - {aaf1b8d7-791e-40f1-a278-9a16d9667866} - True - - - - 11 - - - - -if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries" -if not exist "$(TargetDir)NativeBinaries\x86" md "$(TargetDir)NativeBinaries\x86" -xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86" -if not exist "$(TargetDir)NativeBinaries\amd64" md "$(TargetDir)NativeBinaries\amd64" -xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64" - - @@ -169,4 +116,62 @@ xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd + + + True + + + + + + + + + + + + + + + + + + + + + + + Git + {726a13b9-f319-40fa-aef6-fe629cfdaf6a} + True + + + Pe + {12331d73-8eb9-4a60-9079-00d26b71a04b} + True + + + SourceLink + {aaf1b8d7-791e-40f1-a278-9a16d9667866} + True + + + SymbolStore + {f764ced4-2f3c-49ec-ba9f-99105707b607} + True + + + + 11 + + + + +if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries" +if not exist "$(TargetDir)NativeBinaries\x86" md "$(TargetDir)NativeBinaries\x86" +xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86" +if not exist "$(TargetDir)NativeBinaries\amd64" md "$(TargetDir)NativeBinaries\amd64" +xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp\lib\net40\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64" + + \ No newline at end of file diff --git a/ConsoleTest/Dia.fsx b/ConsoleTest/Dia.fsx deleted file mode 100644 index fd01e8d..0000000 --- a/ConsoleTest/Dia.fsx +++ /dev/null @@ -1,47 +0,0 @@ -#r "../Dia/bin/Debug/Microsoft.Dia.dll" -#r "../Dia/bin/Debug/SourceLink.Dia.dll" -#r "../SourceLink/bin/Debug/SourceLink.dll" - -open System -open System.IO -open Microsoft.Dia -open SourceLink.Dia -open SourceLink - -let printGuidAge file = - let sn = IDiaSession.Open file - let gs = sn.globalScope - printfn "%A %d" gs.guid gs.age - -let printTables file = - let sn = IDiaSession.Open file - for t in sn.SeqTables() do - printfn "%s %d" t.name t.count - -let printCompilands file = - let sn = IDiaSession.Open file - let cs = sn.findChildren(sn.globalScope, SymTagEnum.SymTagCompiland, null, 0u) - for c in cs.Seq() do - printfn "%d %s" c.symIndexId c.name - -let printSourceFiles file = - let sn = IDiaSession.Open file - let sfs = sn.Tables.SourceFiles - printfn "# of source files %d" sfs.count - for sf in sfs.Seq() do - printfn "%d %s" sf.uniqueId sf.fileName - -let printSourceFileCompilands file = - let sn = IDiaSession.Open file - let sfs = sn.Tables.SourceFiles - for sf in sfs.Seq() do - printfn "%s" sf.fileName - for sym in sf.compilands.Seq() do - printfn " %s" sym.name - -let file = Path.combine __SOURCE_DIRECTORY__ @"..\packages\FSharp.Data.2.0.3\lib\net40\FSharp.Data.DesignTime.pdb" -printGuidAge file -printTables file -printCompilands file -printSourceFiles file -printSourceFileCompilands file \ No newline at end of file diff --git a/ConsoleTest/Program.fs b/ConsoleTest/Program.fs index 9e5b5e5..3413826 100644 --- a/ConsoleTest/Program.fs +++ b/ConsoleTest/Program.fs @@ -5,6 +5,7 @@ open System.IO open SourceLink //open SourceLink.PdbModify //open SourceLink.SrcSrv +open SourceLink.SymbolStore let getNugetExeShas() = let f = @"C:\Projects\SourceLink\.nuget\NuGet.exe" @@ -12,9 +13,36 @@ let getNugetExeShas() = use r = new GitRepo(@"C:\Projects\SourceLink") printfn "in repo: %s" (r.Checksum f) +// print methods and their files and line numbers +let printMethodsFileLines() = + let dll = @"..\..\..\packages\SourceLink.SymbolStore\lib\net45\SourceLink.SymbolStore.dll" + let pdb = Path.ChangeExtension(dll, ".pdb") + let sc = SymbolCache @"C:\tmp\cache" + use s = File.OpenRead pdb + use r = sc.ReadPdb(s, pdb) + + for d in r.Documents do + for m in d.GetMethods r.ISymUnmanagedReader2 do + let token = m.Token.GetToken() + let fn = m.GetFileNameFromOffset 0 + + printfn "%d method in %s" token fn + printfn " %d sequence points" m.SequencePointCount + for p in m.SequencePoints do + printfn "%d, %d" p.Line p.Column + () + + +// let a = Assembly.LoadFrom dll +// for dt in a.DefinedTypes do +// printfn "\n%s" dt.FullName +// for m in dt.GetMembers() do +// printfn " %d %s" m.MetadataToken m.Name + [] let main argv = - getNugetExeShas() +// getNugetExeShas() // let mdd = Cor.CorMetaDataDispenser() :> Cor.IMetaDataDispenser // printfn "mdd: %A" mdd + printMethodsFileLines() 0 diff --git a/ConsoleTest/printfn.fs b/ConsoleTest/printfn.fs new file mode 100644 index 0000000..504160f --- /dev/null +++ b/ConsoleTest/printfn.fs @@ -0,0 +1,4 @@ +[] +module Printfn + +let printfn format = Printf.ksprintf (fun message -> System.Diagnostics.Debug.WriteLine message) format \ No newline at end of file diff --git a/Git/Git.fsproj b/Git/Git.fsproj index ba59930..be52eb7 100644 --- a/Git/Git.fsproj +++ b/Git/Git.fsproj @@ -38,26 +38,6 @@ 11 - - - - - - - - - - True - - - - - - SourceLink - {aaf1b8d7-791e-40f1-a278-9a16d9667866} - True - - @@ -135,4 +115,24 @@ + + + + + + + + + + True + + + + + + SourceLink + {aaf1b8d7-791e-40f1-a278-9a16d9667866} + True + + \ No newline at end of file diff --git a/Pe/Pe.fsproj b/Pe/Pe.fsproj index e61e1d7..b8d5af4 100644 --- a/Pe/Pe.fsproj +++ b/Pe/Pe.fsproj @@ -39,26 +39,6 @@ 11 - - - - - - - True - - - - - - - - - SourceLink - {aaf1b8d7-791e-40f1-a278-9a16d9667866} - True - - @@ -280,4 +260,24 @@ + + + + + + + True + + + + + + + + + SourceLink + {aaf1b8d7-791e-40f1-a278-9a16d9667866} + True + + \ No newline at end of file diff --git a/SymbolStore/ISymEncMethod.cs b/SymbolStore/ISymEncMethod.cs index 90d6e53..34cb757 100644 --- a/SymbolStore/ISymEncMethod.cs +++ b/SymbolStore/ISymEncMethod.cs @@ -19,7 +19,7 @@ namespace SourceLink.SymbolStore [ ComVisible(false) ] - public interface ISymbolEnCMethod: ISymbolMethod + public interface ISymbolEnCMethod { String GetFileNameFromOffset(int dwOffset); diff --git a/SymbolStore/ISymReader2.cs b/SymbolStore/ISymReader2.cs index 8a6ce6f..c1071fb 100644 --- a/SymbolStore/ISymReader2.cs +++ b/SymbolStore/ISymReader2.cs @@ -18,7 +18,7 @@ namespace SourceLink.SymbolStore [ ComVisible(false) ] - public interface ISymbolReader2 : ISymbolReader, IDisposable + public interface ISymbolReader2 : IDisposable { // Initialize the symbol reader with the metadata importer interface // that this reader will be associated with, along with the filename diff --git a/SymbolStore/ISymUnmanagedReader2.cs b/SymbolStore/ISymUnmanagedReader2.cs new file mode 100644 index 0000000..368f193 --- /dev/null +++ b/SymbolStore/ISymUnmanagedReader2.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Runtime.InteropServices; + +//namespace Roslyn.Utilities.Pdb +namespace SourceLink.SymbolStore +{ + [Guid("A09E53B2-2A57-4cca-8F63-B84F7C35D4AA")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface ISymUnmanagedReader2 + { + void __GetDocument(/*...*/); + void __GetDocuments(/*...*/); + void __GetUserEntryPoint(/*...*/); + void __GetMethod(/*...*/); + void __GetMethodByVersion(/*...*/); + void __GetVariables(/*...*/); + void __GetGlobalVariables(/*...*/); + void __GetMethodFromDocumentPosition(/*...*/); + void __GetSymAttribute(/*...*/); + void __GetNamespaces(/*...*/); + void __Initialize(/*...*/); + void __UpdateSymbolStore(/*...*/); + void __ReplaceSymbolStore(/*...*/); + void __GetSymbolStoreFileName(/*...*/); + void __GetMethodsFromDocumentPosition(/*...*/); + void __GetDocumentVersion(/*...*/); + void __GetMethodVersion(/*...*/); + + /// + /// Get a symbol reader method given a method token and an E&C + /// version number. Version numbers start at 1 and are incremented + /// each time the method is changed due to an E&C operation. + /// + void __GetMethodByVersionPreRemap(/*[in] mdMethodDef token, + [in] int version, + [out, retval] ISymUnmanagedMethod** pRetVal*/); + /// + /// Gets a custom attribute based upon its name. Not to be + /// confused with Metadata custom attributes, these attributes are + /// held in the symbol store. + /// + void __GetSymAttributePreRemap(/*[in] mdToken parent, + [in] WCHAR* name, + [in] ULONG32 cBuffer, + [out] ULONG32* pcBuffer, + [out, size_is(cBuffer), + length_is(*pcBuffer)] BYTE buffer[]*/); + + /// + /// Gets every method that has line information in the provided Document. + /// + void GetMethodsInDocument( + ISymUnmanagedDocument document, + int cMethod, + out int pcMethod, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ISymUnmanagedMethod[] pRetVal); + } +} diff --git a/SymbolStore/PdbReader.cs b/SymbolStore/PdbReader.cs index 9ca8ae1..da3a8a8 100644 --- a/SymbolStore/PdbReader.cs +++ b/SymbolStore/PdbReader.cs @@ -10,10 +10,10 @@ //namespace Roslyn.Test.PdbUtilities namespace SourceLink.SymbolStore { - public sealed class PdbReader : IDisposable, ISymbolReader + public sealed class PdbReader : IDisposable { private ISymUnmanagedReader rawReader; - private ISymbolReader symReader; + private SymReader symReader; private IntPtr sessionCookie; private long moduleCookie; @@ -25,7 +25,7 @@ public PdbReader(ISymUnmanagedReader rawReader, IntPtr sessionCookie, string fil if (String.IsNullOrEmpty(fileName)) this.moduleCookie = 0; else - this.moduleCookie = SrcSrv.LoadModule(sessionCookie, fileName, this.SymUnmanagedSourceServerModule); + this.moduleCookie = SrcSrv.LoadModule(sessionCookie, fileName, this.ISymUnmanagedSourceServerModule); } public PdbReader(Stream pdb, IntPtr sessionCookie, string fileName) : @@ -61,7 +61,7 @@ public void Dispose() } } - public ISymUnmanagedReader SymUnmanagedReader + public ISymUnmanagedReader ISymUnmanagedReader { get { @@ -74,7 +74,12 @@ public ISymUnmanagedReader SymUnmanagedReader } } - public ISymUnmanagedSourceServerModule SymUnmanagedSourceServerModule + public ISymUnmanagedReader2 ISymUnmanagedReader2 + { + get { return (ISymUnmanagedReader2)rawReader; } + } + + public ISymUnmanagedSourceServerModule ISymUnmanagedSourceServerModule { get { return (ISymUnmanagedSourceServerModule)rawReader; } } @@ -90,43 +95,33 @@ public string GetDownloadUrl(string sourceFilePath) return SrcSrv.GetFileUrl(sessionCookie, moduleCookie, sourceFilePath); } - // implicit ISymbolReader interface implemenation - - public ISymbolDocument GetDocument(string url, Guid language, Guid languageVendor, Guid documentType) + public SymDocument[] Documents { - return this.symReader.GetDocument(url, language, languageVendor, documentType); + get { return this.symReader.GetDocuments(); } } - public ISymbolDocument[] GetDocuments() - { - return this.symReader.GetDocuments(); - } + // ISymbolReader methods, removed some that throw NotImplementedException + // some of these may too, TODO test them - public ISymbolVariable[] GetGlobalVariables() + public ISymbolDocument GetDocument(string url, Guid language, Guid languageVendor, Guid documentType) { - return this.symReader.GetGlobalVariables(); + return this.symReader.GetDocument(url, language, languageVendor, documentType); } - - public ISymbolMethod GetMethod(SymbolToken method, int version) + public SymMethod GetMethod(SymbolToken method, int version) { return this.symReader.GetMethod(method, version); } - public ISymbolMethod GetMethod(SymbolToken method) + public SymMethod GetMethod(SymbolToken method) { return this.symReader.GetMethod(method); } - public ISymbolMethod GetMethodFromDocumentPosition(ISymbolDocument document, int line, int column) + public SymMethod GetMethodFromDocumentPosition(ISymbolDocument document, int line, int column) { return this.symReader.GetMethodFromDocumentPosition(document, line, column); } - public ISymbolNamespace[] GetNamespaces() - { - return this.symReader.GetNamespaces(); - } - public byte[] GetSymAttribute(SymbolToken parent, string name) { return this.symReader.GetSymAttribute(parent, name); @@ -142,22 +137,5 @@ public SymbolToken UserEntryPoint get { return this.symReader.UserEntryPoint; } } - // convenience getters - - public ISymbolDocument[] Documents - { - get { return this.symReader.GetDocuments(); } - } - - public ISymbolVariable[] GlobalVariables - { - get { return this.symReader.GetGlobalVariables(); } - } - - public ISymbolNamespace[] Namespaces - { - get { return this.symReader.GetNamespaces(); } - } - } } diff --git a/SymbolStore/SequencePoint.cs b/SymbolStore/SequencePoint.cs new file mode 100644 index 0000000..1ca8ff2 --- /dev/null +++ b/SymbolStore/SequencePoint.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SourceLink.SymbolStore +{ + public class SequencePoint + { + public int Offset { get; } + public SymDocument Document { get; } + public int Line { get; } + public int Column { get; } + public int EndLine { get; } + public int EndColumn { get; } + + public SequencePoint(int offset, SymDocument document, int line, int column, int endLine, int endColumn) + { + Offset = offset; + Document = document; + Line = line; + Column = column; + EndLine = endLine; + EndColumn = endColumn; + } + } +} diff --git a/SymbolStore/SymDocument.cs b/SymbolStore/SymDocument.cs index c60a32d..06658cc 100644 --- a/SymbolStore/SymDocument.cs +++ b/SymbolStore/SymDocument.cs @@ -57,11 +57,11 @@ void GetSourceRange(int startLine, }; /// - internal class SymbolDocument : ISymbolDocument + public class SymDocument : ISymbolDocument { ISymUnmanagedDocument m_unmanagedDocument; - internal SymbolDocument(ISymUnmanagedDocument document) + public SymDocument(ISymUnmanagedDocument document) { if (document == null) { @@ -170,8 +170,6 @@ public int SourceLength } } - - /// public byte[] GetSourceRange(int startLine, int startColumn, int endLine, int endColumn) @@ -184,13 +182,32 @@ public byte[] GetSourceRange(int startLine, int startColumn, return Data; } - internal ISymUnmanagedDocument InternalDocument + public ISymUnmanagedDocument InternalDocument { get { return m_unmanagedDocument; } } - + + // from Roslyn.Test.PdbUtilities.PdbToXmlConverter + public static ISymUnmanagedMethod[] GetMethodsInDocument(ISymUnmanagedReader2 symReader, ISymUnmanagedDocument symDocument) + { + int count; + symReader.GetMethodsInDocument(symDocument, 0, out count, null); + + var result = new ISymUnmanagedMethod[count]; + symReader.GetMethodsInDocument(symDocument, count, out count, result); + + return result; + } + + public SymMethod[] GetMethods(ISymUnmanagedReader2 symReader) + { + return Array.ConvertAll( + SymDocument.GetMethodsInDocument(symReader, m_unmanagedDocument), + m => new SymMethod(m)); + } + } } diff --git a/SymbolStore/SymMethod.cs b/SymbolStore/SymMethod.cs index e4444f0..580abf4 100644 --- a/SymbolStore/SymMethod.cs +++ b/SymbolStore/SymMethod.cs @@ -39,7 +39,7 @@ void GetRanges(ISymUnmanagedDocument document, void GetParameters(int cParams, out int pcParams, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] ISymUnmanagedVariable[] parms); - void GetNamespace([MarshalAs(UnmanagedType.Interface)] out ISymUnmanagedNamespace retVal); + //void GetNamespace([MarshalAs(UnmanagedType.Interface)] out ISymUnmanagedNamespace retVal); // NIE void GetSourceStartEnd(ISymUnmanagedDocument[] docs, [In, Out, MarshalAs(UnmanagedType.LPArray)] int[] lines, [In, Out, MarshalAs(UnmanagedType.LPArray)] int[] columns, @@ -76,7 +76,7 @@ void GetLineFromOffset(int dwOffset, } - internal class SymMethod : ISymbolMethod, ISymbolEnCMethod + public class SymMethod : ISymbolEnCMethod { ISymUnmanagedMethod m_unmanagedMethod; @@ -109,6 +109,25 @@ public int SequencePointCount } } + public SequencePoint[] SequencePoints + { + get + { + var count = SequencePointCount; + var docs = new ISymUnmanagedDocument[count]; + var offsets = new int[count]; + var lines = new int[count]; + var columns = new int[count]; + var endLines = new int[count]; + var endColumns = new int[count]; + m_unmanagedMethod.GetSequencePoints(count, out count, offsets, docs, lines, columns, endLines, endColumns); // NIE! + var points = new SequencePoint[count]; + for (var i = 0; i < count; i++) + points[i] = new SequencePoint(offsets[i], new SymDocument(docs[i]), lines[i], columns[i], endLines[i], endColumns[i]); + return points; + } + } + public void GetSequencePoints(int[] offsets, ISymbolDocument[] documents, int[] lines, @@ -161,14 +180,14 @@ public void GetSequencePoints(int[] offsets, // Create the SymbolDocument form the IntPtr's for (i = 0; i < documents.Length; i++) { - documents[i] = new SymbolDocument(unmanagedDocuments[i]); + documents[i] = new SymDocument(unmanagedDocuments[i]); } return; } - public ISymbolScope RootScope + public SymScope RootScope { get { @@ -178,34 +197,33 @@ public ISymbolScope RootScope } } - public ISymbolScope GetScope(int offset) + public SymScope GetScope(int offset) { ISymUnmanagedScope retVal = null; m_unmanagedMethod.GetScopeFromOffset(offset, out retVal); return new SymScope(retVal); } - public int GetOffset(ISymbolDocument document, + public int GetOffset(SymDocument document, int line, int column) { int retVal = 0; - m_unmanagedMethod.GetOffset(((SymbolDocument)document).InternalDocument, line, column, out retVal); + m_unmanagedMethod.GetOffset(document.InternalDocument, line, column, out retVal); return retVal; } - public int[] GetRanges(ISymbolDocument document, + public int[] GetRanges(SymDocument document, int line, int column) { int cRanges = 0; - m_unmanagedMethod.GetRanges(((SymbolDocument)document).InternalDocument, line, column, 0, out cRanges, null); + m_unmanagedMethod.GetRanges(document.InternalDocument, line, column, 0, out cRanges, null); int[] Ranges = new int[cRanges]; - m_unmanagedMethod.GetRanges(((SymbolDocument)document).InternalDocument, line, column, cRanges, out cRanges, Ranges); + m_unmanagedMethod.GetRanges(document.InternalDocument, line, column, cRanges, out cRanges, Ranges); return Ranges; } - public ISymbolVariable[] GetParameters() { int cVariables = 0; @@ -223,13 +241,6 @@ public ISymbolVariable[] GetParameters() return Variables; } - public ISymbolNamespace GetNamespace() - { - ISymUnmanagedNamespace retVal = null; - m_unmanagedMethod.GetNamespace(out retVal); - return new SymNamespace(retVal); - } - public bool GetSourceStartEnd(ISymbolDocument[] docs, int[] lines, int[] columns) @@ -264,7 +275,7 @@ public bool GetSourceStartEnd(ISymbolDocument[] docs, { for (i = 0; i < docs.Length;i++) { - docs[i] = new SymbolDocument(unmanagedDocuments[i]); + docs[i] = new SymDocument(unmanagedDocuments[i]); } } return pRetVal; diff --git a/SymbolStore/SymReader.cs b/SymbolStore/SymReader.cs index ab47a55..90f5448 100644 --- a/SymbolStore/SymReader.cs +++ b/SymbolStore/SymReader.cs @@ -159,7 +159,9 @@ public interface ISymUnmanagedDispose } - internal class SymReader : ISymbolReader, ISymbolReader2, ISymbolReaderSymbolSearchInfo, ISymbolEncUpdate, IDisposable + internal class SymReader + : //ISymbolReader2, + ISymbolReaderSymbolSearchInfo, ISymbolEncUpdate, IDisposable { private ISymUnmanagedReader m_reader; // Unmanaged Reader pointer @@ -187,7 +189,7 @@ public void Dispose() m_reader = null; } - public ISymbolDocument GetDocument(String url, + public SymDocument GetDocument(String url, Guid language, Guid languageVendor, Guid documentType) @@ -198,23 +200,16 @@ public ISymbolDocument GetDocument(String url, { return null; } - return new SymbolDocument(document); + return new SymDocument(document); } - public ISymbolDocument[] GetDocuments() + public SymDocument[] GetDocuments() { int cDocs = 0; m_reader.GetDocuments(0, out cDocs, null); - ISymUnmanagedDocument[] unmanagedDocuments = new ISymUnmanagedDocument[cDocs]; - m_reader.GetDocuments(cDocs, out cDocs, unmanagedDocuments); - - ISymbolDocument[] documents = new SymbolDocument[cDocs]; - uint i; - for (i = 0; i < cDocs; i++) - { - documents[i] = new SymbolDocument(unmanagedDocuments[i]); - } - return documents; + var docs = new ISymUnmanagedDocument[cDocs]; + m_reader.GetDocuments(cDocs, out cDocs, docs); + return Array.ConvertAll(docs, doc => new SymDocument(doc)); } public SymbolToken UserEntryPoint @@ -237,7 +232,7 @@ public SymbolToken UserEntryPoint } } - public ISymbolMethod GetMethod(SymbolToken method) + public SymMethod GetMethod(SymbolToken method) { ISymUnmanagedMethod unmanagedMethod = null; int hr = m_reader.GetMethod(method, out unmanagedMethod); @@ -254,7 +249,7 @@ public ISymbolMethod GetMethod(SymbolToken method) return new SymMethod(unmanagedMethod); } - public ISymbolMethod GetMethod(SymbolToken method, int version) + public SymMethod GetMethod(SymbolToken method, int version) { ISymUnmanagedMethod unmanagedMethod = null; int hr = m_reader.GetMethodByVersion(method, version, out unmanagedMethod); @@ -303,12 +298,12 @@ public ISymbolVariable[] GetGlobalVariables() return variables; } - public ISymbolMethod GetMethodFromDocumentPosition(ISymbolDocument document, + public SymMethod GetMethodFromDocumentPosition(ISymbolDocument document, int line, int column) { ISymUnmanagedMethod unmanagedMethod = null; - m_reader.GetMethodFromDocumentPosition(((SymbolDocument)document).InternalDocument, line, column, out unmanagedMethod); + m_reader.GetMethodFromDocumentPosition(((SymDocument)document).InternalDocument, line, column, out unmanagedMethod); return new SymMethod(unmanagedMethod); } @@ -383,17 +378,17 @@ public String GetSymbolStoreFileName() return fileName.ToString(); } - public ISymbolMethod[] GetMethodsFromDocumentPosition( + public SymMethod[] GetMethodsFromDocumentPosition( ISymbolDocument document, int line, int column) { ISymUnmanagedMethod[] unmanagedMethods; - ISymbolMethod[] methods; + SymMethod[] methods; int count = 0; uint i; - m_reader.GetMethodsFromDocumentPosition(((SymbolDocument)document).InternalDocument, line, column, 0, out count, null); + m_reader.GetMethodsFromDocumentPosition(((SymDocument)document).InternalDocument, line, column, 0, out count, null); unmanagedMethods = new ISymUnmanagedMethod[count]; - m_reader.GetMethodsFromDocumentPosition(((SymbolDocument)document).InternalDocument, line, column, count, out count, unmanagedMethods); - methods = new ISymbolMethod[count]; + m_reader.GetMethodsFromDocumentPosition(((SymDocument)document).InternalDocument, line, column, count, out count, unmanagedMethods); + methods = new SymMethod[count]; for (i = 0; i < count; i++) { @@ -406,7 +401,7 @@ public int GetDocumentVersion(ISymbolDocument document, out Boolean isCurrent) { int version = 0; - m_reader.GetDocumentVersion(((SymbolDocument)document).InternalDocument, out version, out isCurrent); + m_reader.GetDocumentVersion(((SymDocument)document).InternalDocument, out version, out isCurrent); return version; } diff --git a/SymbolStore/SymScope.cs b/SymbolStore/SymScope.cs index e21ac0a..8d2812e 100644 --- a/SymbolStore/SymScope.cs +++ b/SymbolStore/SymScope.cs @@ -87,11 +87,11 @@ void GetConstants(int cConstants, } - internal class SymScope : ISymbolScope, ISymbolScope2 + public class SymScope //: ISymbolScope, ISymbolScope2 { ISymUnmanagedScope m_target; - internal SymScope(ISymUnmanagedScope target) + public SymScope(ISymUnmanagedScope target) { // We should not wrap null instances if (target == null) @@ -100,7 +100,7 @@ internal SymScope(ISymUnmanagedScope target) m_target = target; } - public ISymbolMethod Method + public SymMethod Method { get { @@ -112,7 +112,7 @@ public ISymbolMethod Method } } - public ISymbolScope Parent + public SymScope Parent { get { @@ -124,7 +124,7 @@ public ISymbolScope Parent } } - public ISymbolScope[] GetChildren() + public SymScope[] GetChildren() { int count; m_target.GetChildren(0, out count, null); @@ -132,7 +132,7 @@ public ISymbolScope[] GetChildren() m_target.GetChildren(count, out count, uScopes); int i; - ISymbolScope[] scopes = new ISymbolScope[count]; + SymScope[] scopes = new SymScope[count]; for (i = 0; i < count; i++) { scopes[i] = new SymScope(uScopes[i]); diff --git a/SymbolStore/SymbolStore.csproj b/SymbolStore/SymbolStore.csproj index 9395035..a4016f7 100644 --- a/SymbolStore/SymbolStore.csproj +++ b/SymbolStore/SymbolStore.csproj @@ -50,7 +50,9 @@ + + diff --git a/Tfs/Tfs.fsproj b/Tfs/Tfs.fsproj index 6ca6379..9f962e4 100644 --- a/Tfs/Tfs.fsproj +++ b/Tfs/Tfs.fsproj @@ -40,60 +40,6 @@ 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - - - - - - - - - - - - SourceLink - {aaf1b8d7-791e-40f1-a278-9a16d9667866} - True - - @@ -171,4 +117,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + + + + + + + SourceLink + {aaf1b8d7-791e-40f1-a278-9a16d9667866} + True + + \ No newline at end of file diff --git a/paket.dependencies b/paket.dependencies index 632c450..73b9c49 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -6,6 +6,7 @@ nuget SourceLink.Fake prerelease nuget FSharp.Formatting nuget NuGet.CommandLine -nuget FSharp.Data nuget LibGit2Sharp -nuget Mono.Cecil \ No newline at end of file +nuget Mono.Cecil + +nuget SourceLink.SymbolStore prerelease \ No newline at end of file diff --git a/paket.lock b/paket.lock index 19409e0..a1bd5cd 100644 --- a/paket.lock +++ b/paket.lock @@ -1,19 +1,19 @@ NUGET remote: http://nuget.org/api/v2 specs: - FAKE (3.9.2) + FAKE (3.9.9) FSharp.Compiler.Service (0.0.67) - FSharp.Data (2.1.0) - Zlib.Portable (>= 1.10.0) - portable-7.0 FSharp.Formatting (2.4.36) FSharp.Compiler.Service (0.0.67) Microsoft.AspNet.Razor (2.0.30506.0) RazorEngine (3.3.0) - LibGit2Sharp (0.20.0.0) + LibGit2Sharp (0.20.0) Microsoft.AspNet.Razor (2.0.30506.0) Mono.Cecil (0.9.5.4) NuGet.CommandLine (2.8.3) RazorEngine (3.3.0) Microsoft.AspNet.Razor (>= 2.0.30506.0) - SourceLink.Fake (0.4.2) - Zlib.Portable (1.10.0) + remote: https://ci.appveyor.com/nuget/sourcelink-helmesfwai2a + specs: + SourceLink.Fake (0.5.0-ci1411141431) + SourceLink.SymbolStore (0.5.0-ci1411141431) diff --git a/paket.references b/paket.references index d2448eb..4ce8e3a 100644 --- a/paket.references +++ b/paket.references @@ -1,4 +1,5 @@ FAKE SourceLink.Fake FSharp.Formatting -NuGet.CommandLine \ No newline at end of file +NuGet.CommandLine +SourceLink.SymbolStore \ No newline at end of file