Skip to content

Refactor type name retrieval to use GetTypeId method#41

Merged
IvanMurzak merged 5 commits intomainfrom
refactor/type-id
Dec 17, 2025
Merged

Refactor type name retrieval to use GetTypeId method#41
IvanMurzak merged 5 commits intomainfrom
refactor/type-id

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

  • Updated TypeReflectionConverter to use GetTypeId instead of GetTypeName for better type identification.
  • Modified ExtensionsSerializedMemberList to retrieve parameter type names using GetTypeId.
  • Changed ExtensionsType to ensure consistent use of GetTypeId across various methods.
  • Refactored MethodData to utilize GetTypeId for return types and parameters.
  • Updated MethodRef to use GetTypeShortName for better clarity in type representation.
  • Adjusted SerializedMember to initialize typeName with GetTypeId.
  • Enhanced MethodWrapper to provide clearer error messages using GetTypeId.
  • Refined Reflector.DefaultValue to throw errors with GetTypeId for unsupported types.
  • Improved error handling in Reflector.Error to utilize GetTypeId for type mismatch messages.
  • Updated Reflector.FindMethod to compare parameter types using GetTypeId.
  • Enhanced Reflector.Populate to log type information using GetTypeId.
  • Refactored Reflector to throw exceptions with GetTypeId for unsupported serialization/deserialization types.
  • Improved JsonSchema to throw exceptions with GetTypeId for schema retrieval failures.
  • Enhanced Print utility methods to log type information using GetTypeId.
  • Updated StringUtils to throw exceptions with GetTypeId for parameter mismatches.
  • Refactored TypeUtils to cache resolved type names and improve type resolution logic.

- Updated TypeReflectionConverter to use GetTypeId instead of GetTypeName for better type identification.
- Modified ExtensionsSerializedMemberList to retrieve parameter type names using GetTypeId.
- Changed ExtensionsType to ensure consistent use of GetTypeId across various methods.
- Refactored MethodData to utilize GetTypeId for return types and parameters.
- Updated MethodRef to use GetTypeShortName for better clarity in type representation.
- Adjusted SerializedMember to initialize typeName with GetTypeId.
- Enhanced MethodWrapper to provide clearer error messages using GetTypeId.
- Refined Reflector.DefaultValue to throw errors with GetTypeId for unsupported types.
- Improved error handling in Reflector.Error to utilize GetTypeId for type mismatch messages.
- Updated Reflector.FindMethod to compare parameter types using GetTypeId.
- Enhanced Reflector.Populate to log type information using GetTypeId.
- Refactored Reflector to throw exceptions with GetTypeId for unsupported serialization/deserialization types.
- Improved JsonSchema to throw exceptions with GetTypeId for schema retrieval failures.
- Enhanced Print utility methods to log type information using GetTypeId.
- Updated StringUtils to throw exceptions with GetTypeId for parameter mismatches.
- Refactored TypeUtils to cache resolved type names and improve type resolution logic.
@IvanMurzak IvanMurzak self-assigned this Dec 17, 2025
@IvanMurzak IvanMurzak requested a review from Copilot December 17, 2025 07:52
@IvanMurzak IvanMurzak added the enhancement New feature or request label Dec 17, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 17, 2025

Test Results

    3 files  ± 0      3 suites  ±0   6m 16s ⏱️ + 2m 49s
  632 tests +12    632 ✅ +12  0 💤 ±0  0 ❌ ±0 
1 858 runs  +36  1 858 ✅ +36  0 💤 ±0  0 ❌ ±0 

Results for commit dd0c074. ± Comparison against base commit d1a5aa5.

This pull request removes 16 and adds 28 tests. Note that renamed tests count towards both.
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ComplexNestedCollections_ShouldHandleDeepNesting
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_HashSetOfInt_ShouldNormalizeToArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_LinkedListOfInt_ShouldNormalizeToArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListAndArrayOfCustomClass_ShouldMatch
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfCustomClass_ShouldNormalizeToArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfDoubleNestedArray_ShouldAppendThreeArrays
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfIntArray_ShouldNormalizeToDoubleArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfInt_ShouldNormalizeToArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfListOfInt_ShouldMatchIntDoubleArray
com.IvanMurzak.ReflectorNet.Tests.SchemaTests.TestSchemaTypeId ‑ GetSchemaTypeId_ListOfListOfInt_ShouldNormalizeToDoubleArray
…
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_BuiltInArrayTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_BuiltInGenericTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_BuiltInTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_ComplexCombinedTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_NestedGenericTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_OuterAssemblyArrayTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_OuterAssemblyTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_ReflectorNetTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeIdTests ‑ GetTypeId_ThisAssemblyTypes
com.IvanMurzak.ReflectorNet.Tests.TypeUtilsTests.GetTypeShortNameTests ‑ GetTypeShortName_BuiltInArrayTypes
…

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 refactors type name retrieval across the codebase to use the GetTypeId() method instead of GetTypeName(pretty: false) for better type identification consistency. The changes introduce significant improvements to type resolution capabilities while also making a breaking change to the array suffix format.

Key Changes

  • Enhanced type resolution: Added comprehensive support for resolving C#-style generic types (e.g., List<int>), classic generic types, array types, and nested types with thread-safe caching
  • Breaking API change: Modified ArraySuffix constant from "_Array" to "[]" for more natural type representation
  • Comprehensive updates: Replaced GetTypeName(pretty: false) with GetTypeId() across 40+ files including converters, error messages, and logging statements
  • New test coverage: Added extensive test suites (GetTypeIdTests.cs and GetTypeTests.cs) with 500+ lines of test code covering various type scenarios

Reviewed changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
ReflectorNet/src/Utils/TypeUtils.cs Added thread-safe caching and new type resolution methods for arrays, C#-style generics, and classic generics
ReflectorNet/src/Utils/TypeUtils.Name.cs Updated GetTypeId() to handle nested generic types, changed ArraySuffix constant, improved multi-dimensional array support
ReflectorNet/src/Utils/StringUtils.cs Updated error messages to use GetTypeId()
ReflectorNet/src/Utils/Print/Print.cs Updated logging statements to use GetTypeId()
ReflectorNet/src/Utils/Json/JsonSchema.cs Updated exception messages to use GetTypeId()
ReflectorNet/src/Reflector/*.cs Updated error messages and logging to use GetTypeId() across Reflector core files
ReflectorNet/src/Model/*.cs Updated MethodRef, MethodData, SerializedMember to use GetTypeId()
ReflectorNet/src/Extension/*.cs Updated extension methods to use GetTypeId()
ReflectorNet/src/Converter/**/*.cs Updated all converters to use GetTypeId() in error messages and type comparisons
ReflectorNet.Tests/**/*.cs Updated 10+ test files to use GetTypeId() and added 2 new comprehensive test files
ReflectorNet.Tests.OuterAssembly/src/Model/TypeIdTestModels.cs Added 195 lines of test model classes for comprehensive type testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ReflectorNet/src/Utils/TypeUtils.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.cs
Comment thread ReflectorNet.Tests/src/TypeUtilsTests/GetTypeTests.cs
Comment thread ReflectorNet.Tests/src/TypeUtilsTests/GetTypeIdTests.cs
Comment thread ReflectorNet/src/Utils/TypeUtils.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.cs Outdated
Comment thread ReflectorNet/src/Utils/TypeUtils.cs Outdated
@IvanMurzak IvanMurzak merged commit 3842d58 into main Dec 17, 2025
2 checks passed
@IvanMurzak IvanMurzak deleted the refactor/type-id branch December 17, 2025 09:19
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