Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c3452e09
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3452e09
编写于
4月 27, 2016
作者:
T
Tomáš Matoušek
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10824 from tmat/DSRP_Cleanup
Clean up PortablePdb shims
上级
d444aa42
c0bcc1c6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
89 addition
and
36 deletion
+89
-36
src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/SymBinderTests.cs
...icrosoft.DiaSymReader.PortablePdb.Tests/SymBinderTests.cs
+30
-30
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.csproj
...der.PortablePdb/Microsoft.DiaSymReader.PortablePdb.csproj
+1
-3
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec
...der.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec
+0
-3
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Utilities/PortableShim.cs
...rosoft.DiaSymReader.PortablePdb/Utilities/PortableShim.cs
+58
-0
未找到文件。
src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/SymBinderTests.cs
浏览文件 @
c3452e09
...
...
@@ -41,13 +41,13 @@ public void GetReaderForFile_NextToPE()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.pdb"
);
Directory
.
CreateDirectory
(
tempDir
);
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
string
searchPath
=
null
;
...
...
@@ -68,15 +68,15 @@ public void GetReaderForFile_SearchPaths()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
searchDir
,
"Documents.pdb"
);
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
searchDir
);
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
string
searchPath
=
searchDir
;
...
...
@@ -97,15 +97,15 @@ public void GetReaderForFile_SearchPaths_SubDir1()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
searchDir
,
"dll"
,
"Documents.pdb"
);
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
pdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
string
searchPath
=
searchDir
;
...
...
@@ -126,15 +126,15 @@ public void GetReaderForFile_SearchPaths_SubDir2()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
searchDir
,
"symbols"
,
"dll"
,
"Documents.pdb"
);
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
pdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
string
searchPath
=
searchDir
;
...
...
@@ -157,7 +157,7 @@ public void GetReaderForFile_SkipNative1()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
searchDir
,
"Documents.pdb"
);
...
...
@@ -166,9 +166,9 @@ public void GetReaderForFile_SkipNative1()
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
pdbFilePath
));
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
nativePdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
PortableShim
.
File
.
WriteAllBytes
(
nativePdbFilePath
,
TestResources
.
Documents
.
Pdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
nativePdbFilePath
,
TestResources
.
Documents
.
Pdb
);
string
searchPath
=
searchDir
;
...
...
@@ -189,7 +189,7 @@ public void GetReaderForFile_SkipNative2()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir1
=
Path
.
Combine
(
tempDir
,
"Dir1"
);
string
searchDir2
=
Path
.
Combine
(
tempDir
,
"Dir2"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
...
...
@@ -199,9 +199,9 @@ public void GetReaderForFile_SkipNative2()
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
pdbFilePath
));
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
nativePdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
PortableShim
.
File
.
WriteAllBytes
(
nativePdbFilePath
,
TestResources
.
Documents
.
Pdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
nativePdbFilePath
,
TestResources
.
Documents
.
Pdb
);
string
searchPath
=
searchDir1
+
";"
+
searchDir2
;
...
...
@@ -222,7 +222,7 @@ public void GetReaderForFile_SkipNonMatching()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
pdbFilePath
=
Path
.
Combine
(
searchDir
,
"Documents.pdb"
);
...
...
@@ -231,9 +231,9 @@ public void GetReaderForFile_SkipNonMatching()
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
pdbFilePath
));
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
anotherPdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
PortableShim
.
File
.
WriteAllBytes
(
anotherPdbFilePath
,
TestResources
.
Async
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
pdbFilePath
,
TestResources
.
Documents
.
PortablePdb
);
File
.
WriteAllBytes
(
anotherPdbFilePath
,
TestResources
.
Async
.
PortablePdb
);
string
searchPath
=
searchDir
;
...
...
@@ -254,15 +254,15 @@ public void GetReaderForFile_MatchingNotFound()
{
var
importer
=
new
SymMetadataImport
(
new
MemoryStream
(
TestResources
.
Documents
.
PortableDll
));
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
P
ortableShim
.
P
ath
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
tempDir
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
Path
.
GetTempFileName
()),
Guid
.
NewGuid
().
ToString
());
string
searchDir
=
Path
.
Combine
(
tempDir
,
"Dir"
);
string
peFilePath
=
Path
.
Combine
(
tempDir
,
"Documents.dll"
);
string
anotherPdbFilePath
=
Path
.
Combine
(
searchDir
,
"symbols"
,
"dll"
,
"Documents.pdb"
);
Directory
.
CreateDirectory
(
tempDir
);
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
anotherPdbFilePath
));
PortableShim
.
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
PortableShim
.
File
.
WriteAllBytes
(
anotherPdbFilePath
,
TestResources
.
Async
.
PortablePdb
);
File
.
WriteAllBytes
(
peFilePath
,
TestResources
.
Documents
.
PortableDll
);
File
.
WriteAllBytes
(
anotherPdbFilePath
,
TestResources
.
Async
.
PortablePdb
);
string
searchPath
=
searchDir
;
...
...
@@ -276,8 +276,8 @@ public void GetReaderForFile_MatchingNotFound()
[
Fact
]
public
void
GetReaderFromPdbFile
()
{
string
filePath
=
P
ortableShim
.
P
ath
.
GetTempFileName
();
PortableShim
.
File
.
WriteAllBytes
(
filePath
,
TestResources
.
Documents
.
PortablePdb
);
string
filePath
=
Path
.
GetTempFileName
();
File
.
WriteAllBytes
(
filePath
,
TestResources
.
Documents
.
PortablePdb
);
ISymUnmanagedReader
symReader
;
Assert
.
Equal
(
HResult
.
S_OK
,
SymBinder
.
GetReaderFromPdbFile
(
NotImplementedMetadataProvider
.
Instance
,
filePath
,
out
symReader
));
...
...
@@ -291,7 +291,7 @@ public void GetReaderFromPdbFile()
Assert
.
Throws
<
ObjectDisposedException
>(()
=>
symReader
.
GetDocuments
(
0
,
out
actualCount
,
null
));
PortableShim
.
File
.
Delete
(
filePath
);
File
.
Delete
(
filePath
);
}
[
Fact
]
...
...
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.csproj
浏览文件 @
c3452e09
...
...
@@ -28,9 +28,6 @@
<Compile
Include=
"..\..\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs"
>
<Link>
Utilities\ReflectionUtilities.cs
</Link>
</Compile>
<Compile
Include=
"..\..\Compilers\Core\Portable\PortableShim.cs"
>
<Link>
Utilities\PortableShim.cs
</Link>
</Compile>
<Compile
Include=
"..\Roslyn.Reflection.Metadata.Decoding\ArrayShape.cs"
>
<Link>
System.Reflection.Metadata.Decoding\ArrayShape.cs
</Link>
</Compile>
...
...
@@ -87,6 +84,7 @@
<Compile
Include=
"SymMethod.cs"
/>
<Compile
Include=
"SymReader.cs"
/>
<Compile
Include=
"SymVariable.cs"
/>
<Compile
Include=
"Utilities\PortableShim.cs"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"project.json"
/>
...
...
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec
浏览文件 @
c3452e09
...
...
@@ -17,7 +17,6 @@
<dependency
id=
"System.Collections"
version=
"4.0.11-rc2-24022"
/>
<dependency
id=
"System.Collections.Immutable"
version=
"1.2.0-rc2-24022"
/>
<dependency
id=
"System.Diagnostics.Debug"
version=
"4.0.11-rc2-24022"
/>
<dependency
id=
"System.Globalization"
version=
"4.0.0-rc2-24022"
/>
<dependency
id=
"System.IO"
version=
"4.1.0-rc2-24022"
/>
<dependency
id=
"System.Linq"
version=
"4.1.0-rc2-24022"
/>
<dependency
id=
"System.Reflection"
version=
"4.1.0-rc2-24022"
/>
...
...
@@ -26,9 +25,7 @@
<dependency
id=
"System.Runtime"
version=
"4.1.0-rc2-24022"
/>
<dependency
id=
"System.Runtime.Extensions"
version=
"4.1.0-rc2-24022"
/>
<dependency
id=
"System.Runtime.InteropServices"
version=
"4.1.0-rc2-24022"
/>
<dependency
id=
"System.Text.Encoding"
version=
"4.0.11-rc2-24022"
/>
<dependency
id=
"System.Threading"
version=
"4.0.11-rc2-24022"
/>
<dependency
id=
"System.Xml.XDocument"
version=
"4.0.11-rc2-24022"
/>
</group>
</dependencies>
<language>
en-US
</language>
...
...
src/Debugging/Microsoft.DiaSymReader.PortablePdb/Utilities/PortableShim.cs
0 → 100644
浏览文件 @
c3452e09
// Copyright (c) Microsoft. 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.Collections.Generic
;
using
System.Globalization
;
using
System.IO
;
using
System.Reflection
;
using
Roslyn.Utilities
;
namespace
Microsoft.DiaSymReader.PortablePdb
{
internal
static
class
PortableShim
{
private
static
class
CoreNames
{
internal
const
string
System_IO_FileSystem
=
"System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
;
internal
const
string
System_Runtime_Extensions
=
"System.Runtime.Extensions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
;
}
internal
static
class
Environment
{
internal
const
string
TypeName
=
"System.Environment"
;
internal
static
readonly
Type
Type
=
ReflectionUtilities
.
GetTypeFromEither
(
contractName
:
$"
{
TypeName
}
,
{
CoreNames
.
System_Runtime_Extensions
}
"
,
desktopName
:
TypeName
);
internal
static
Func
<
string
,
string
>
GetEnvironmentVariable
=
(
Func
<
string
,
string
>)
Type
.
GetTypeInfo
()
.
GetDeclaredMethod
(
nameof
(
GetEnvironmentVariable
),
paramTypes
:
new
[]
{
typeof
(
string
)
})
.
CreateDelegate
(
typeof
(
Func
<
string
,
string
>));
}
internal
static
class
File
{
internal
const
string
TypeName
=
"System.IO.File"
;
internal
static
readonly
Type
Type
=
ReflectionUtilities
.
GetTypeFromEither
(
contractName
:
$"
{
TypeName
}
,
{
CoreNames
.
System_IO_FileSystem
}
"
,
desktopName
:
TypeName
);
internal
static
readonly
Func
<
string
,
Stream
>
OpenRead
=
Type
.
GetTypeInfo
()
.
GetDeclaredMethod
(
nameof
(
OpenRead
),
paramTypes
:
new
[]
{
typeof
(
string
)
})
.
CreateDelegate
<
Func
<
string
,
Stream
>>();
internal
static
readonly
Func
<
string
,
bool
>
Exists
=
Type
.
GetTypeInfo
()
.
GetDeclaredMethod
(
nameof
(
Exists
),
new
[]
{
typeof
(
string
)
})
.
CreateDelegate
<
Func
<
string
,
bool
>>();
internal
static
readonly
Func
<
string
,
byte
[
]>
ReadAllBytes
=
Type
.
GetTypeInfo
()
.
GetDeclaredMethod
(
nameof
(
ReadAllBytes
),
paramTypes
:
new
[]
{
typeof
(
string
)
})
.
CreateDelegate
<
Func
<
string
,
byte
[
]>
>();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录