Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
440b3961
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,发现更多精彩内容 >>
提交
440b3961
编写于
1月 04, 2016
作者:
A
Andy Gocke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Respond to PR comments
上级
5811385c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
58 addition
and
58 deletion
+58
-58
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
+9
-0
src/Compilers/CSharp/Portable/CSharpResources.resx
src/Compilers/CSharp/Portable/CSharpResources.resx
+3
-0
src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs
...t/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs
+38
-57
src/Compilers/VisualBasic/Portable/Errors/Errors.vb
src/Compilers/VisualBasic/Portable/Errors/Errors.vb
+1
-0
src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb
...sualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb
+4
-0
src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb
...t/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb
+3
-1
未找到文件。
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
浏览文件 @
440b3961
...
...
@@ -7216,6 +7216,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Public sign was specified and requires a public key, but no public key was specified.
/// </summary>
internal static string ERR_PublicSignNoKey {
get {
return ResourceManager.GetString("ERR_PublicSignNoKey", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The range variable '{0}' has already been declared.
/// </summary>
...
...
src/Compilers/CSharp/Portable/CSharpResources.resx
浏览文件 @
440b3961
...
...
@@ -3794,6 +3794,9 @@ You should consider suppressing the warning only if you're sure that you don't w
<data
name=
"ERR_SignButNoPrivateKey"
xml:space=
"preserve"
>
<value>
Key file '{0}' is missing the private key needed for signing
</value>
</data>
<data
name=
"ERR_PublicSignNoKey"
xml:space=
"preserve"
>
<value>
Public sign was specified and requires a public key, but no public key was specified
</value>
</data>
<data
name=
"WRN_DelaySignButNoKey"
xml:space=
"preserve"
>
<value>
Delay signing was specified and requires a public key, but no public key was specified
</value>
</data>
...
...
src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs
浏览文件 @
440b3961
...
...
@@ -420,6 +420,24 @@ public class C {}
Assert
.
Equal
(
CorFlags
.
ILOnly
|
CorFlags
.
StrongNameSigned
,
metadata
.
Module
.
PEReaderOpt
.
PEHeaders
.
CorHeader
.
Flags
);
}
private
void
VerifySignedBitSetAfterEmit
(
Compilation
comp
)
{
var
outStrm
=
new
MemoryStream
();
var
emitResult
=
comp
.
Emit
(
outStrm
);
Assert
.
True
(
emitResult
.
Success
);
outStrm
.
Position
=
0
;
// Verify that the sign bit is set
using
(
var
reader
=
new
PEReader
(
outStrm
))
{
Assert
.
True
(
reader
.
HasMetadata
);
var
flags
=
reader
.
PEHeaders
.
CorHeader
.
Flags
;
Assert
.
True
(
flags
.
HasFlag
(
CorFlags
.
StrongNameSigned
));
}
}
[
Fact
]
public
void
SnkFile_PublicSign
()
{
...
...
@@ -437,20 +455,7 @@ public void SnkFile_PublicSign()
Assert
.
False
(
comp
.
IsRealSigned
);
Assert
.
NotNull
(
comp
.
Options
.
CryptoKeyFile
);
var
outStrm
=
new
MemoryStream
();
var
emitResult
=
comp
.
Emit
(
outStrm
);
Assert
.
True
(
emitResult
.
Success
);
outStrm
.
Position
=
0
;
// Verify that the sign bit is set
using
(
var
reader
=
new
PEReader
(
outStrm
))
{
Assert
.
True
(
reader
.
HasMetadata
);
var
flags
=
reader
.
PEHeaders
.
CorHeader
.
Flags
;
Assert
.
True
(
flags
.
HasFlag
(
CorFlags
.
StrongNameSigned
));
}
VerifySignedBitSetAfterEmit
(
comp
);
}
[
Fact
]
...
...
@@ -470,20 +475,7 @@ public void PublicKeyFile_PublicSign()
Assert
.
False
(
comp
.
IsRealSigned
);
Assert
.
NotNull
(
comp
.
Options
.
CryptoKeyFile
);
var
outStrm
=
new
MemoryStream
();
var
emitResult
=
comp
.
Emit
(
outStrm
);
Assert
.
True
(
emitResult
.
Success
);
outStrm
.
Position
=
0
;
// Verify that the sign bit is set
using
(
var
reader
=
new
PEReader
(
outStrm
))
{
Assert
.
True
(
reader
.
HasMetadata
);
var
flags
=
reader
.
PEHeaders
.
CorHeader
.
Flags
;
Assert
.
True
(
flags
.
HasFlag
(
CorFlags
.
StrongNameSigned
));
}
VerifySignedBitSetAfterEmit
(
comp
);
}
[
Fact
]
...
...
@@ -507,23 +499,9 @@ public class C {}",
Assert
.
False
(
comp
.
IsRealSigned
);
Assert
.
NotNull
(
comp
.
Options
.
CryptoKeyFile
);
var
outStrm
=
new
MemoryStream
();
var
emitResult
=
comp
.
Emit
(
outStrm
);
Assert
.
True
(
emitResult
.
Success
);
outStrm
.
Position
=
0
;
// Verify that the sign bit is set
using
(
var
reader
=
new
PEReader
(
outStrm
))
{
Assert
.
True
(
reader
.
HasMetadata
);
var
flags
=
reader
.
PEHeaders
.
CorHeader
.
Flags
;
Assert
.
True
(
flags
.
HasFlag
(
CorFlags
.
StrongNameSigned
));
}
VerifySignedBitSetAfterEmit
(
comp
);
}
[
Fact
]
public
void
KeyContainerNoSNProvider_PublicSign
()
{
...
...
@@ -555,20 +533,7 @@ public void KeyContainerDesktopProvider_PublicSign()
Assert
.
False
(
comp
.
IsRealSigned
);
Assert
.
NotNull
(
comp
.
Options
.
CryptoKeyContainer
);
var
outStrm
=
new
MemoryStream
();
var
emitResult
=
comp
.
Emit
(
outStrm
);
Assert
.
True
(
emitResult
.
Success
);
outStrm
.
Position
=
0
;
// Verify that the sign bit is set
using
(
var
reader
=
new
PEReader
(
outStrm
))
{
Assert
.
True
(
reader
.
HasMetadata
);
var
flags
=
reader
.
PEHeaders
.
CorHeader
.
Flags
;
Assert
.
True
(
flags
.
HasFlag
(
CorFlags
.
StrongNameSigned
));
}
VerifySignedBitSetAfterEmit
(
comp
);
}
[
Fact
]
...
...
@@ -585,8 +550,24 @@ public void PublicSignAndDelaySign()
comp
.
VerifyDiagnostics
(
// error CS7102: Compilation options 'PublicSign' and 'DelaySign' can't both be specified at the same time.
Diagnostic
(
ErrorCode
.
ERR_MutuallyExclusiveOptions
).
WithArguments
(
"PublicSign"
,
"DelaySign"
).
WithLocation
(
1
,
1
));
Assert
.
True
(
comp
.
Options
.
PublicSign
);
Assert
.
True
(
comp
.
Options
.
DelaySign
);
}
[
Fact
]
public
void
PublicSignNoKey
()
{
var
comp
=
CreateCompilationWithMscorlib
(
"public class C {}"
,
options
:
TestOptions
.
ReleaseDll
.
WithPublicSign
(
true
));
comp
.
VerifyDiagnostics
(
// error CS8102: Public signing was specified and requires a public key, but no public key was specified.
Diagnostic
(
ErrorCode
.
ERR_PublicSignButNoKey
).
WithLocation
(
1
,
1
)
);
Assert
.
True
(
comp
.
Options
.
PublicSign
);
Assert
.
True
(
comp
.
Assembly
.
PublicKey
.
IsDefaultOrEmpty
);
}
[
Fact
]
public
void
PublicKeyFromOptions_InvalidCompilationOptions
()
...
...
src/Compilers/VisualBasic/Portable/Errors/Errors.vb
浏览文件 @
440b3961
...
...
@@ -1680,6 +1680,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_InterpolatedStringFactoryError
=
37251
ERR_DebugEntryPointNotSourceMethodDefinition
=
37252
ERR_InvalidPathMap
=
37253
ERR_PublicSignNoKey
=
37254
ERR_LastPlusOne
...
...
src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb
浏览文件 @
440b3961
...
...
@@ -1184,6 +1184,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
diagnostics
.
Add
(
ERRID
.
WRN_DelaySignButNoKey
,
NoLocation
.
Singleton
)
End
If
If
DeclaringCompilation
.
Options
.
PublicSign
AndAlso
Not
Identity
.
HasPublicKey
Then
diagnostics
.
Add
(
ERRID
.
ERR_PublicSignNoKey
,
NoLocation
.
Singleton
)
End
If
' If the options and attributes applied on the compilation imply real signing,
' but we have no private key to sign it with report an error.
' Note that if public key is set and delay sign is off we do OSS signing, which doesn't require private key.
...
...
src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb
浏览文件 @
440b3961
...
...
@@ -1664,7 +1664,9 @@ End Class
</file>
</compilation>, options:=options
)
comp.VerifyDiagnostics()
comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_PublicSignNoKey).WithLocation(1, 1))
Assert.True(comp.Options.PublicSign)
Assert.True(comp.Assembly.PublicKey.IsDefaultOrEmpty)
End Sub
<Fact>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录