Skip to content

Commit

Permalink
Fix processing of TypeSpec (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Jun 2, 2023
1 parent 0576670 commit c1fd20d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions MetadataProcessor.Shared/Tables/nanoTypeSpecificationsTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,22 @@ public bool TryGetTypeReferenceId(
TypeReference typeReference,
out ushort referenceId)
{
return _idByTypeSpecifications.TryGetValue(typeReference, out referenceId);
if (typeReference == null) // This case is possible for encoding 'nested inside' case
{
referenceId = 0xFFFF;
return true;
}

referenceId = GetOrCreateTypeSpecificationId(typeReference);

return true;
}

public TypeReference TryGetTypeSpecification(MetadataToken token)
{
foreach (var t in _idByTypeSpecifications)
{
if(t.Key.MetadataToken == token)
if (t.Key.MetadataToken == token)
{
return t.Key;
}
Expand Down

0 comments on commit c1fd20d

Please sign in to comment.