This repository was archived by the owner on Feb 12, 2023. It is now read-only.
Commit d3dd63e 1 parent 75f9935 commit d3dd63e Copy full SHA for d3dd63e
File tree 3 files changed +62
-0
lines changed
3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 75
75
<Compile Include =" Pdb\PdbStream.cs" />
76
76
<Compile Include =" Pdb\SrcSrv.cs" />
77
77
<Compile Include =" Pdb\SrcSrvContext.cs" />
78
+ <Compile Include =" Helpers\PortablePdbHelper.cs" />
78
79
<Compile Include =" Program.cs" />
79
80
<Compile Include =" Properties\AssemblyInfo.cs" />
80
81
<Compile Include =" Providers\BitBucketProvider.cs" />
Original file line number Diff line number Diff line change
1
+ // --------------------------------------------------------------------------------------------------------------------
2
+ // <copyright file="PortablePdbHelper.cs" company="CatenaLogic">
3
+ // Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
4
+ // </copyright>
5
+ // --------------------------------------------------------------------------------------------------------------------
6
+
7
+ namespace GitLink
8
+ {
9
+ using System . IO ;
10
+
11
+ internal static class PortablePdbHelper
12
+ {
13
+ /// <summary>
14
+ /// Is the given .pdb using the new Portable format ? (https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md)
15
+ /// </summary>
16
+ /// <param name="pdbPath">.pdb file path</param>
17
+ /// <returns>Returns if it's a Portable PDB</returns>
18
+ public static bool IsPortablePdb ( string pdbPath )
19
+ {
20
+ using ( var fs = File . Open ( pdbPath , FileMode . Open , FileAccess . Read ) )
21
+ using ( var br = new BinaryReader ( fs ) )
22
+ {
23
+ // More infos in chapter II.24.2 of ECMA-335 (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf)
24
+ var signature = 0x424A5342 ;
25
+ if ( br . ReadUInt32 ( ) != signature )
26
+ {
27
+ return false ;
28
+ }
29
+
30
+ var majorVersion = br . ReadUInt16 ( ) ;
31
+ if ( majorVersion != 1 )
32
+ {
33
+ return false ;
34
+ }
35
+
36
+ var minorVersion = br . ReadUInt16 ( ) ;
37
+ if ( minorVersion != 1 )
38
+ {
39
+ return false ;
40
+ }
41
+
42
+ var reserved = br . ReadUInt32 ( ) ;
43
+ if ( reserved != 0 )
44
+ {
45
+ return false ;
46
+ }
47
+
48
+ var versionLength = br . ReadUInt32 ( ) ;
49
+ var version = System . Text . Encoding . UTF8 . GetString ( br . ReadBytes ( ( int ) versionLength ) ) ;
50
+
51
+ return version . StartsWith ( "PDB v1.0" ) ;
52
+ }
53
+ }
54
+ }
55
+ }
Original file line number Diff line number Diff line change @@ -50,6 +50,12 @@ public static class Linker
50
50
}
51
51
}
52
52
53
+ if ( PortablePdbHelper . IsPortablePdb ( pdbPath ) )
54
+ {
55
+ Log . Warning ( "Portable PDB format is not compatible with GitLink. Please use SourceLink (https://github.com/ctaggart/SourceLink)." ) ;
56
+ return true ;
57
+ }
58
+
53
59
if ( options . IndexAllDepotFiles )
54
60
{
55
61
if ( repositoryDirectory == null )
You can’t perform that action at this time.
0 commit comments