fix: resolve inheritance hiding and covariant array warnings#9046
fix: resolve inheritance hiding and covariant array warnings#9046NickKhalow wants to merge 3 commits into
Conversation
| { | ||
| internal readonly Sprite toggleIcon; | ||
|
|
||
| public ToggleWithIconContextMenuControlSettings(Sprite toggleIcon, string toggleText, Action<bool> toggleAction, RectOffset horizontalLayoutPadding = null, int horizontalLayoutSpacing = 30, |
There was a problem hiding this comment.
Compile error (CS0191): Removing internal readonly Sprite toggleIcon from this class causes this.toggleIcon = toggleIcon in the constructor body to target the inherited readonly field on ToggleContextMenuControlSettings. C# only allows readonly fields to be assigned in a constructor of the declaring class, so this emits CS0191.
The correct fix to suppress the CS0108 warning without breaking the build is:
| public ToggleWithIconContextMenuControlSettings(Sprite toggleIcon, string toggleText, Action<bool> toggleAction, RectOffset horizontalLayoutPadding = null, int horizontalLayoutSpacing = 30, | |
| internal new readonly Sprite toggleIcon; | |
Alternatively, change the base-constructor call to the overload that accepts toggleIcon and remove the body assignment:
: base(toggleText, toggleAction, toggleIcon, horizontalLayoutPadding, horizontalLayoutSpacing, horizontalLayoutReverseArrangement)but that is a behavioural change (base-class field would become non-null) and is out of scope for a warning-cleanup PR.
| @@ -8,7 +8,6 @@ public class ToggleWithIconAndCheckContextMenuControlSettings : ToggleContextMen | |||
| { | |||
| internal readonly ToggleGroup toggleGroup; | |||
| internal readonly Sprite icon; | |||
There was a problem hiding this comment.
Compile error (CS0191): Same issue as ToggleWithIconContextMenuControlSettings. Removing internal readonly Color iconColor here means line 28 (this.iconColor = iconColor == …) targets the inherited readonly field on ToggleContextMenuControlSettings, which C# does not permit from a derived-class constructor.
| internal readonly Sprite icon; | |
| internal readonly ToggleGroup toggleGroup; | |
| internal readonly Sprite icon; | |
| internal new readonly Color iconColor; |
This comment has been minimized.
This comment has been minimized.
| TrimmedWearableDTO TrimmedDTO { get; } | ||
|
|
||
|
|
||
| public bool IsSmart() => |
There was a problem hiding this comment.
Compile error (CS1061): Removing TrimmedWearableDTO TrimmedDTO { get; } means the default method IsSmart() now resolves TrimmedDTO to the base ITrimmedAvatarAttachment.TrimmedDTO, which has return type TrimmedAvatarAttachmentDTO. That abstract base class has no metadata field (only the generic subclass TrimmedAvatarAttachmentDTO<TMetadata> does), so TrimmedDTO.metadata.isSmart fails with CS1061.
The fix that's consistent with how ITrimmedEmote was corrected is to keep the re-declaration but mark it explicit with new:
| public bool IsSmart() => | |
| public bool IsSmart() => |
Apply this suggestion only after restoring the declaration above it:
new TrimmedWearableDTO TrimmedDTO { get; }i.e., the full corrected block:
public interface ITrimmedWearable : ITrimmedAvatarAttachment<TrimmedWearableDTO>
{
public int Amount { get; set; }
bool IsCompatibleWithBodyShape(string bodyShape);
new TrimmedWearableDTO TrimmedDTO { get; }
public bool IsSmart() =>
TrimmedDTO.metadata.isSmart;
...
}|
Claude finished @NickKhalow's task in 4m 8s —— View job PR Re-Review — fix: resolve inheritance hiding and covariant array warnings
StatusThe PR was synchronised but the three compile errors flagged in the previous review are unchanged. Exact fixes are below — all were verified locally. Blocking Issues (still present)1.
|

Pull Request Description
What does this PR change?
Resolves two classes of type-safety compiler warnings flagged by static analysis: member-hiding (CS0108 / CS0114) and covariant array conversion (
CoVariantArrayConversion). No behavioral change is intended — these are correctness/clarity fixes that make hiding explicit and remove an array-write hazard.CoVariantArrayConversion —
Derived[]exposed asIBase[]:Exposing a
Derived[]through anIBase[]surface allows an element write that throwsArrayTypeMismatchExceptionat runtime. Removed the writable-array surface:ICommunityMemberPagedResponse.membersand both implementations (GetCommunityMembersResponse,GetCommunityInviteRequestResponse) now returnIReadOnlyList<ICommunityMemberData>— a safe covariant, read-only view with no write path. The single consumer (CommunityRequestsReceivedGroupView.SetRequestReceivedMemberItems) was updated to match; all call sites only iterate.ReleaseMemorySystemShouldtest — the array literal is now explicitly typednew UnloadStrategyBase[] { ... }so the array's runtime type matches the field.CS0108 / CS0114 — member hides an inherited member:
For each warning, applied the appropriate fix:
newwhere the hiding is intentional API surface — chiefly the MapRenderer marker interfaces (ICategoryMarker,ISceneOfInterestMarker,ISearchResultMarker,IClusterMarker,IPinMarker,IAtlasController) re-declaring base-interface members, plusIEmote/ITrimmed*and a few fields/types.IMemoryProfiler.SystemUsedMemoryInBytes, redundant shadowing fields on the toggle context-menu settings).Test Instructions
Pure warnings/type-safety cleanup with no intended behavioral change — primarily a sanity check that nothing regressed.
Steps (standard run):
metaforge explorer run XXXX # ← replace with this PR numberExpected result:
Test Steps
Additional Testing Notes
ReleaseMemorySystemShouldwas touched (array typing) and should still pass.Quality Checklist