Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #823 from microsoft/dev
Browse files Browse the repository at this point in the history
Fix the issue #821: PublicKeyToken parsing doesn't handle not strong named assembly
  • Loading branch information
Lxiamail authored Nov 12, 2019
2 parents 65d5dc8 + df36fb5 commit d5e366f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/Microsoft.Fx.Portability/Analyzer/PublicKeyToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public bool Equals(PublicKeyToken other)

public override int GetHashCode()
{
if (Token.IsEmpty)
return 0;

int hash = 19;
unchecked
{
Expand Down Expand Up @@ -83,6 +86,9 @@ public override string ToString()

private static ImmutableArray<byte> ParseString(string hex)
{
if ((string.Compare(hex, "null", true, CultureInfo.InvariantCulture) == 0) || hex == null)
return ImmutableArray<byte>.Empty;

if (hex.Length % 2 != 0)
{
throw new PortabilityAnalyzerException(string.Format(CultureInfo.InvariantCulture, LocalizedStrings.InvalidPublicKeyToken, hex));
Expand Down

0 comments on commit d5e366f

Please sign in to comment.