update: Optimized type search by name#64
Conversation
…type retrieval and failure cases
There was a problem hiding this comment.
Pull request overview
This pull request introduces assembly-prefixed type resolution capabilities to optimize type search performance and enable more precise type blacklisting. The changes refactor the large TypeUtils.cs file into smaller partial classes and add new utilities for filtering assemblies and types by name prefix.
Changes:
- Added
GetAssembliesStartingWithandGetTypesStartingWithmethods toAssemblyUtilsfor filtering by assembly name prefix - Introduced assembly-aware type resolution with a new
TypeUtils.GetType(assemblyName, typeName)overload and supporting infrastructure with LRU caching - Enhanced type blacklist functionality with
BlacklistType(assemblyPrefix, typeFullName)andBlacklistTypesInAssemblymethods for targeted type exclusion
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| ReflectorNet/src/Utils/TypeUtils.cs | Converted to minimal placeholder with comment explaining split into partial classes |
| ReflectorNet/src/Utils/TypeUtils.GetType.cs | New public API for type resolution with optional assembly prefix filtering |
| ReflectorNet/src/Utils/TypeUtils.GetType.Private.cs | Private helper methods for type resolution including array, generic, and nested type handling |
| ReflectorNet/src/Utils/TypeUtils.Cache.cs | Caching infrastructure with LRU caches for type resolution and enumerable item types |
| ReflectorNet/src/Utils/TypeUtils.Collections.cs | Collection helper methods moved from main TypeUtils file |
| ReflectorNet/src/Utils/TypeUtils.Helpers.cs | Type helper utilities moved from main TypeUtils file |
| ReflectorNet/src/Utils/TypeUtils.Description.cs | Description attribute utilities moved from main TypeUtils file |
| ReflectorNet/src/Utils/AssemblyUtils.cs | Added GetAssembliesStartingWith and GetTypesStartingWith methods for prefix-based filtering |
| ReflectorNet/src/Reflector/Reflector.Registry.cs | New blacklist methods supporting assembly-prefixed type resolution |
| ReflectorNet.Tests/src/Utils/AssemblyUtilsTests.cs | Comprehensive tests for assembly prefix filtering with 197 new test lines |
| ReflectorNet.Tests/src/TypeUtilsTests/GetTypeWithAssemblyTests.cs | New test suite with 466 lines covering assembly-prefixed type resolution scenarios |
| ReflectorNet.Tests/src/ReflectorTests/IsTypeBlacklistedTests.cs | Added 464 lines of tests for assembly-prefixed blacklist functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…actoring related methods
…ch method and enhancing type resolution
…methods and improving assembly handling
…ix and streamline type resolution
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ity and usability
… clarity and consistency
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…stency and clarity; streamline type blacklisting logic
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pe blacklisting functionality
This pull request introduces new utilities for working with assemblies and types by prefix, enhances type blacklist functionality, and adds caching and collection helpers to improve performance and usability. The most important changes are grouped below:
Assembly and Type Filtering by Prefix
GetAssembliesStartingWithandGetTypesStartingWithmethods toAssemblyUtilsfor retrieving assemblies and types whose names start with a specified prefix, supporting variousStringComparisonoptions. [1] [2]GetAssembliesStartingWith, covering prefix matching, case sensitivity, empty/null handling, and enumerable behavior.Type Blacklisting Enhancements
BlacklistType(string assemblyNamePrefix, string typeFullName)andBlacklistTypesInAssembly(string assemblyNamePrefix, params string[] typeFullNames)to allow blacklisting types by searching only in assemblies with a given prefix, enabling more precise type resolution. [1] [2]Type Utilities: Caching and Collection Helpers
TypeUtils.Cacheimplementing LRU caches for type name resolution, assembly-prefixed type lookups, and enumerable item types, with methods to clear each cache.TypeUtils.Collectionswith helpers to identify and extract generic arguments from dictionaries and enumerables, including cached resolution of enumerable item types.