roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Reduce GetTypeByMetadataName allocations for fail-path

Open Youssef1313 opened this issue 1 year ago • 2 comments

Fixes #64142

Per my understanding, this is the root cause of https://github.com/unoplatform/uno/issues/7506

Youssef1313 avatar Sep 21 '22 09:09 Youssef1313

            result = scope.LookupMetadataType(ref emittedName);

Is this call going to allocate a missing symbol when lookup fails?


Refers to: src/Compilers/CSharp/Portable/Symbols/NonMissingModuleSymbol.cs:203 in 86aedd9. [](commit_id = 86aedd93cecd94e16ba18fa1d578f82a170035fb, deletion_comment = False)

AlekseyTs avatar Sep 21 '22 14:09 AlekseyTs

                CacheTopLevelMetadataType(ref emittedName, result);

It doesn't look like we want to cache null here.


Refers to: src/Compilers/CSharp/Portable/Symbols/NonMissingAssemblySymbol.cs:177 in 86aedd9. [](commit_id = 86aedd93cecd94e16ba18fa1d578f82a170035fb, deletion_comment = False)

AlekseyTs avatar Sep 21 '22 14:09 AlekseyTs