Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Find out more about Portable PDB #93

Closed
ctaggart opened this issue Jul 23, 2015 · 8 comments
Closed

Find out more about Portable PDB #93

ctaggart opened this issue Jul 23, 2015 · 8 comments
Assignees

Comments

@ctaggart
Copy link
Owner

Miguel de Icaza blogged a couple of days ago bout new new Portable Program Database (PPDB) files format.

Portable PDB v0.1: Format Specification Draft
https://github.com/dotnet/roslyn/blob/master/docs/specs/PortablePdb-Metadata.md

Code got merged to Roslyn master 10 days ago:
dotnet/roslyn#3891

@ctaggart
Copy link
Owner Author

ctaggart commented Sep 8, 2015

Mono 4.2.0 was released with support for the PPDB format which is version 0.1.
http://www.mono-project.com/docs/about-mono/releases/4.2.0/

@ctaggart
Copy link
Owner Author

@ctaggart
Copy link
Owner Author

ctaggart commented Nov 5, 2015

The related code above exposes a portable pdb to the existing Windows DiaSymReader for compatibility with existing Windows APIs.

@ctaggart
Copy link
Owner Author

ctaggart commented Nov 5, 2015

Great progress today at the Microsoft MVP Summit and a plan is in place for the cross platform portable pdb format. Portable pdb is the future for .NET.
aspnet/Universe#131 (comment)

@ctaggart
Copy link
Owner Author

ctaggart commented Nov 9, 2015

I proposed that F# switch to the portable pdb format. dotnet/fsharp#718

@ctaggart
Copy link
Owner Author

ctaggart commented Nov 9, 2015

The discussion for adding .pdb files to the NuGet packages in Roslyn is dotnet/roslyn#3. They will be the trend setter.

@ctaggart
Copy link
Owner Author

It is easy to read in the portable pdb format using System.Reflection.Metadata.
https://www.nuget.org/packages/System.Reflection.Metadata

open System.Reflection.Metadata
open System.Runtime.InteropServices
open System.IO
open Microsoft.FSharp.NativeInterop

#nowarn "9"

let printfn format = Printf.ksprintf System.Diagnostics.Debug.WriteLine format

[<EntryPoint>]
let main argv = 
    let f = @"C:\cs\roslyn\Binaries\Obj\PdbUtilities\Release\Roslyn.Test.PdbUtilities.pdb"
    let bytes = File.ReadAllBytes f
    let pBytes = GCHandle.Alloc(bytes, GCHandleType.Pinned)
    let mr = MetadataReader(pBytes.AddrOfPinnedObject() |> NativePtr.ofNativeInt, bytes.Length)
    for dh in mr.Documents do
        let d = mr.GetDocument dh
        let name = mr.GetString d.Name
        let language = mr.GetGuid d.Language
        let hashAlgorithm = mr.GetGuid d.HashAlgorithm
        let hash = mr.GetBlobBytes d.Hash

        // Hex.fs from https://github.com/ctaggart/SourceLink/blob/master/SourceLink/Hex.fs
        printfn "%s %s" (Hex.encode hash) name
    pBytes.Free() // reminder for later
    0 

The SHA1 for StringUtilities does indeed match:
image

image

@ctaggart
Copy link
Owner Author

ctaggart commented Feb 6, 2017

Portable PDB support is coming in #121.

@ctaggart ctaggart closed this as completed Feb 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant