Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6ef45b42
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,发现更多精彩内容 >>
未验证
提交
6ef45b42
编写于
1月 04, 2019
作者:
J
Jared Parsons
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Respond to PR feedback
上级
26488169
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
58 addition
and
46 deletion
+58
-46
src/Compilers/Core/Portable/Compilation.EmitStream.cs
src/Compilers/Core/Portable/Compilation.EmitStream.cs
+49
-39
src/Compilers/Core/Portable/Compilation/Compilation.cs
src/Compilers/Core/Portable/Compilation/Compilation.cs
+2
-2
src/Compilers/Core/Portable/StrongName/DesktopStrongNameProvider.cs
...ers/Core/Portable/StrongName/DesktopStrongNameProvider.cs
+6
-4
src/Compilers/Core/Portable/StrongName/StrongNameProvider.cs
src/Compilers/Core/Portable/StrongName/StrongNameProvider.cs
+1
-1
未找到文件。
src/Compilers/Core/Portable/Compilation.EmitStream.cs
浏览文件 @
6ef45b42
...
@@ -72,14 +72,33 @@ internal Func<Stream> GetCreateStreamFunc(DiagnosticBag diagnostics)
...
@@ -72,14 +72,33 @@ internal Func<Stream> GetCreateStreamFunc(DiagnosticBag diagnostics)
return
()
=>
CreateStream
(
diagnostics
);
return
()
=>
CreateStream
(
diagnostics
);
}
}
internal
void
Disp
ose
()
internal
void
Cl
ose
()
{
{
_tempInfo
?.
tempStream
.
Dispose
();
_tempInfo
=
null
;
// The _stream value is deliberately excluded from being disposed here. That value is not
// The _stream value is deliberately excluded from being disposed here. That value is not
// owned by this type.
// owned by this type.
_stream
=
null
;
_stream
=
null
;
if
(
_tempInfo
.
HasValue
)
{
var
(
tempStream
,
tempFilePath
)
=
_tempInfo
.
GetValueOrDefault
();
_tempInfo
=
null
;
try
{
tempStream
.
Dispose
();
}
finally
{
try
{
File
.
Delete
(
tempFilePath
);
}
catch
{
// Not much to do if we can't delete from the temp directory
}
}
}
}
}
/// <summary>
/// <summary>
...
@@ -139,53 +158,44 @@ internal bool Complete(StrongNameKeys strongNameKeys, CommonMessageProvider mess
...
@@ -139,53 +158,44 @@ internal bool Complete(StrongNameKeys strongNameKeys, CommonMessageProvider mess
Debug
.
Assert
(
_stream
!=
null
);
Debug
.
Assert
(
_stream
!=
null
);
Debug
.
Assert
(
_emitStreamSignKind
!=
EmitStreamSignKind
.
SignedWithFile
||
_tempInfo
.
HasValue
);
Debug
.
Assert
(
_emitStreamSignKind
!=
EmitStreamSignKind
.
SignedWithFile
||
_tempInfo
.
HasValue
);
if
(
_tempInfo
.
HasValue
)
try
{
{
Debug
.
Assert
(
_emitStreamSignKind
==
EmitStreamSignKind
.
SignedWithFile
);
if
(
_tempInfo
.
HasValue
)
var
(
tempStream
,
tempFilePath
)
=
_tempInfo
.
GetValueOrDefault
();
try
{
{
// Dispose the temp stream to ensure all of the contents are written to
Debug
.
Assert
(
_emitStreamSignKind
==
EmitStreamSignKind
.
SignedWithFile
);
// disk.
var
(
tempStream
,
tempFilePath
)
=
_tempInfo
.
GetValueOrDefault
();
tempStream
.
Dispose
();
_strongNameProvider
.
SignFile
(
strongNameKeys
,
tempFilePath
);
try
using
(
var
tempFileStream
=
new
FileStream
(
tempFilePath
,
FileMode
.
Open
))
{
{
tempFileStream
.
CopyTo
(
_stream
);
// Dispose the temp stream to ensure all of the contents are written to
// disk.
tempStream
.
Dispose
();
_strongNameProvider
.
SignFile
(
strongNameKeys
,
tempFilePath
);
using
(
var
tempFileStream
=
new
FileStream
(
tempFilePath
,
FileMode
.
Open
))
{
tempFileStream
.
CopyTo
(
_stream
);
}
}
}
}
catch
(
DesktopStrongNameProvider
.
ClrStrongNameMissingException
)
catch
(
DesktopStrongNameProvider
.
ClrStrongNameMissingException
)
{
diagnostics
.
Add
(
StrongNameKeys
.
GetError
(
strongNameKeys
.
KeyFilePath
,
strongNameKeys
.
KeyContainer
,
new
CodeAnalysisResourcesLocalizableErrorArgument
(
nameof
(
CodeAnalysisResources
.
AssemblySigningNotSupported
)),
messageProvider
));
return
false
;
}
catch
(
IOException
ex
)
{
diagnostics
.
Add
(
StrongNameKeys
.
GetError
(
strongNameKeys
.
KeyFilePath
,
strongNameKeys
.
KeyContainer
,
ex
.
Message
,
messageProvider
));
return
false
;
}
finally
{
try
{
{
File
.
Delete
(
tempFilePath
);
diagnostics
.
Add
(
StrongNameKeys
.
GetError
(
strongNameKeys
.
KeyFilePath
,
strongNameKeys
.
KeyContainer
,
new
CodeAnalysisResourcesLocalizableErrorArgument
(
nameof
(
CodeAnalysisResources
.
AssemblySigningNotSupported
)),
messageProvider
));
return
false
;
}
}
catch
catch
(
IOException
ex
)
{
{
// Not much to do if we can't delete from the temp directory
diagnostics
.
Add
(
StrongNameKeys
.
GetError
(
strongNameKeys
.
KeyFilePath
,
strongNameKeys
.
KeyContainer
,
ex
.
Message
,
messageProvider
));
return
false
;
}
}
tempStream
.
Dispose
();
_tempInfo
=
null
;
_stream
=
null
;
}
}
}
}
finally
{
Close
();
}
_stream
=
null
;
return
true
;
return
true
;
}
}
}
}
...
...
src/Compilers/Core/Portable/Compilation/Compilation.cs
浏览文件 @
6ef45b42
...
@@ -2739,8 +2739,8 @@ internal void EnsureAnonymousTypeTemplates(CancellationToken cancellationToken)
...
@@ -2739,8 +2739,8 @@ internal void EnsureAnonymousTypeTemplates(CancellationToken cancellationToken)
finally
finally
{
{
nativePdbWriter
?.
Dispose
();
nativePdbWriter
?.
Dispose
();
emitPeStream
?.
Disp
ose
();
emitPeStream
?.
Cl
ose
();
emitMetadataStream
?.
Disp
ose
();
emitMetadataStream
?.
Cl
ose
();
pdbBag
?.
Free
();
pdbBag
?.
Free
();
metadataDiagnostics
?.
Free
();
metadataDiagnostics
?.
Free
();
}
}
...
...
src/Compilers/Core/Portable/StrongName/DesktopStrongNameProvider.cs
浏览文件 @
6ef45b42
...
@@ -103,7 +103,7 @@ internal override StrongNameKeys CreateKeys(string keyFilePath, string keyContai
...
@@ -103,7 +103,7 @@ internal override StrongNameKeys CreateKeys(string keyFilePath, string keyContai
}
}
}
}
return
new
StrongNameKeys
(
keyPair
,
publicKey
,
null
,
container
,
keyFilePath
,
hasCounterSignature
);
return
new
StrongNameKeys
(
keyPair
,
publicKey
,
privateKey
:
null
,
container
,
keyFilePath
,
hasCounterSignature
);
}
}
/// <summary>
/// <summary>
...
@@ -159,13 +159,15 @@ internal virtual void ReadKeysFromContainer(string keyContainer, out ImmutableAr
...
@@ -159,13 +159,15 @@ internal virtual void ReadKeysFromContainer(string keyContainer, out ImmutableAr
internal
override
void
SignFile
(
StrongNameKeys
keys
,
string
filePath
)
internal
override
void
SignFile
(
StrongNameKeys
keys
,
string
filePath
)
{
{
if
(
keys
.
KeyContainer
!=
null
)
Debug
.
Assert
(
string
.
IsNullOrEmpty
(
keys
.
KeyFilePath
)
!=
string
.
IsNullOrEmpty
(
keys
.
KeyContainer
));
if
(!
string
.
IsNullOrEmpty
(
keys
.
KeyFilePath
))
{
{
Sign
(
filePath
,
keys
.
Key
Containe
r
);
Sign
(
filePath
,
keys
.
Key
Pai
r
);
}
}
else
else
{
{
Sign
(
filePath
,
keys
.
Key
Pai
r
);
Sign
(
filePath
,
keys
.
Key
Containe
r
);
}
}
}
}
...
...
src/Compilers/Core/Portable/StrongName/StrongNameProvider.cs
浏览文件 @
6ef45b42
...
@@ -31,7 +31,7 @@ protected StrongNameProvider()
...
@@ -31,7 +31,7 @@ protected StrongNameProvider()
internal
abstract
void
SignFile
(
StrongNameKeys
keys
,
string
filePath
);
internal
abstract
void
SignFile
(
StrongNameKeys
keys
,
string
filePath
);
/// <summary>
/// <summary>
/// Signs the contents of <paramref name="peB
uilder"/> using
<paramref name="privateKey"/>.
/// Signs the contents of <paramref name="peB
lob"/> using <paramref name="peBuilder"/> and
<paramref name="privateKey"/>.
/// </summary>
/// </summary>
internal
abstract
void
SignBuilder
(
ExtendedPEBuilder
peBuilder
,
BlobBuilder
peBlob
,
RSAParameters
privateKey
);
internal
abstract
void
SignBuilder
(
ExtendedPEBuilder
peBuilder
,
BlobBuilder
peBlob
,
RSAParameters
privateKey
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录