Skip to content

update: Optimized type search by name#64

Merged
IvanMurzak merged 17 commits into
mainfrom
update/optimize-blacklist
Jan 31, 2026
Merged

update: Optimized type search by name#64
IvanMurzak merged 17 commits into
mainfrom
update/optimize-blacklist

Conversation

@IvanMurzak

Copy link
Copy Markdown
Owner

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

  • Added GetAssembliesStartingWith and GetTypesStartingWith methods to AssemblyUtils for retrieving assemblies and types whose names start with a specified prefix, supporting various StringComparison options. [1] [2]
  • Comprehensive unit tests were added to validate GetAssembliesStartingWith, covering prefix matching, case sensitivity, empty/null handling, and enumerable behavior.

Type Blacklisting Enhancements

  • Introduced BlacklistType(string assemblyNamePrefix, string typeFullName) and BlacklistTypesInAssembly(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

  • Added a new partial class TypeUtils.Cache implementing LRU caches for type name resolution, assembly-prefixed type lookups, and enumerable item types, with methods to clear each cache.
  • Added a new partial class TypeUtils.Collections with helpers to identify and extract generic arguments from dictionaries and enumerables, including cached resolution of enumerable item types.

@IvanMurzak IvanMurzak requested a review from Copilot January 30, 2026 07:39
@IvanMurzak IvanMurzak self-assigned this Jan 30, 2026
@IvanMurzak IvanMurzak added the enhancement New feature or request label Jan 30, 2026
@github-actions

github-actions Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Test Results

    2 files  ±  0      2 suites  ±0   8m 21s ⏱️ -23s
1 251 tests + 79  1 251 ✅ + 79  0 💤 ±0  0 ❌ ±0 
2 502 runs  +158  2 502 ✅ +158  0 💤 ±0  0 ❌ ±0 

Results for commit d7d128d. ± Comparison against base commit 9c4c006.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GetAssembliesStartingWith and GetTypesStartingWith methods to AssemblyUtils for 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) and BlacklistTypesInAssembly methods 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.

Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.Private.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.Private.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.Private.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs Outdated
Comment thread ReflectorNet.Tests/src/TypeUtilsTests/GetTypeWithAssemblyTests.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Collections.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Description.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet.Tests/src/ReflectorTests/IsTypeBlacklistedTests.cs Outdated
Comment thread ReflectorNet.Tests/src/ReflectorTests/IsTypeBlacklistedTests.cs Outdated
Comment thread ReflectorNet/src/Utils/AssemblyUtils.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Registry.cs Outdated
…stency and clarity; streamline type blacklisting logic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet/src/Utils/TypeUtils.GetType.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.Helpers.cs
@IvanMurzak IvanMurzak merged commit 35a52b2 into main Jan 31, 2026
1 check passed
@IvanMurzak IvanMurzak deleted the update/optimize-blacklist branch January 31, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants