You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1f88aad
Browse filesBrowse the repository at this point in the historyBrowse files
Improve type safety and error handling for indexer access
Refactored DelegateProvider and PropertyData to enhance type safety, correct parameter handling, and improve error messages for reflection-based property and indexer access. Fixed delegate caching bugs, added stricter null and type checks, and ensured correct handling of indexer parameter arrays, especially for multi-parameter indexers. These changes increase robustness and maintainability.
varindexExpressions=newExpression[propertySetMethodParameters.Count-1];// -1 because the last parameter is the value parameter for the setter, not an index parameter.
$"The provided indexer argument at position '{i}' is incompatible with the property's index parameter type. Reason: A conversion to '{indexParameter.FullyQualifiedSignature}' is not natively supported.",
thrownewArgumentNullException(nameof(target),"Target object cannot be null for instance properties.");
366
+
}
367
+
368
+
TypetargetType=target.GetType();
369
+
ArgumentExceptionAdvanced.ThrowIfNotAssignableTo(
370
+
targetType,
371
+
DeclaringTypeData.Type,
372
+
nameof(target),
373
+
$"Type mismatch. Reason: The instance type {targetType.ToFullyQualifiedSignatureName()} is not assignable to {DeclaringTypeData.FullyQualifiedSignature}");
thrownewArgumentNullException(nameof(target),"Target object cannot be null for instance properties.");
409
+
}
410
+
411
+
TypetargetType=target.GetType();
412
+
ArgumentExceptionAdvanced.ThrowIfNotAssignableTo(
413
+
targetType,
414
+
DeclaringTypeData.Type,
415
+
nameof(target),
416
+
$"Type mismatch. Reason: The instance type {targetType.ToFullyQualifiedSignatureName()} is not assignable to {DeclaringTypeData.FullyQualifiedSignature}");
ArgumentNullExceptionAdvanced.ThrowIfNull(indexerPropertyIndex,nameof(indexerPropertyIndex),"Indexer property index cannot be null for indexer properties.");
ArgumentNullExceptionAdvanced.ThrowIfNull(indexerPropertyIndex,nameof(indexerPropertyIndex),"Indexer property index cannot be null for indexer properties.");
0 commit comments