提交 bd3dfede 编写于 作者: A Andy Gocke

PR comments

上级 67a9fd89
......@@ -457,6 +457,14 @@ private StrongNameKeys ComputeStrongNameKeys()
// the attributes. Right now we'll just fall through to the
// "no key available" error.
if (!string.IsNullOrEmpty(keyFile) && !PathUtilities.IsAbsolute(keyFile))
{
// If keyFile has a relative path then there should be a diagnostic
// about it
Debug.Assert(!DeclaringCompilation.Options.Errors.IsEmpty);
return StrongNameKeys.None;
}
// If we're public signing, we don't need a strong name provider
return StrongNameKeys.Create(keyFile, MessageProvider.Instance);
}
......
......@@ -88,13 +88,14 @@ internal static StrongNameKeys Create(ImmutableArray<byte> publicKey, CommonMess
internal static StrongNameKeys Create(string keyFilePath, CommonMessageProvider messageProvider)
{
if (string.IsNullOrEmpty(keyFilePath) || !PathUtilities.IsAbsolute(keyFilePath))
if (string.IsNullOrEmpty(keyFilePath))
{
return None;
}
try
{
Debug.Assert(PathUtilities.IsAbsolute(keyFilePath));
var fileContent = ImmutableArray.Create(PortableShim.File.ReadAllBytes(keyFilePath));
return CreateHelper(fileContent, keyFilePath);
......
......@@ -1593,12 +1593,22 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Return
End If
Dim keys As StrongNameKeys
Dim keyFile As String = _compilation.Options.CryptoKeyFile
' Public sign requires a keyfile
If DeclaringCompilation.Options.PublicSign Then
If Not String.IsNullOrEmpty(keyFile) AndAlso Not PathUtilities.IsAbsolute(keyFile) Then
' If keyFile has a relative path then there should be a diagnostic
' about it
Debug.Assert(Not DeclaringCompilation.Options.Errors.IsEmpty)
keys = StrongNameKeys.None
Else
keys = StrongNameKeys.Create(keyFile, MessageProvider.Instance)
End If
' Public signing doesn't require a strong name provider to be used.
Interlocked.CompareExchange(_lazyStrongNameKeys, StrongNameKeys.Create(keyFile, MessageProvider.Instance), Nothing)
Interlocked.CompareExchange(_lazyStrongNameKeys, keys, Nothing)
Return
End If
......@@ -1621,7 +1631,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End If
End If
Dim keys = StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance)
keys = StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance)
Interlocked.CompareExchange(_lazyStrongNameKeys, keys, Nothing)
End Sub
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册