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
When a property shadows primary constructor parameter and the property is renamed/deleted, the calls to this property from within the instance members of the type will currently throw MethodMissingException.
We could update all the methods to access the primary constructor, or do so from the deleted property.
Test in TopLevelEditingTests.cs
[Fact]publicvoidProperty_Rename_ShadowingPrimaryParameter(){varsrc1=@"class C(int A, int B){ public int B { get; init; } = B; public int F() => B;}";varsrc2=@"class C(int A, int B){ public int D { get; init; } = B; public int F() => B;}";varedits= GetTopEdits(src1, src2);
edits.VerifySemantics(new[]{
SemanticEdit(SemanticEditKind.Delete,c => c.GetMember("C.get_B"), deletedSymbolContainerProvider:c => c.GetMember("C")),
SemanticEdit(SemanticEditKind.Delete,c => c.GetMember("C.set_B"), deletedSymbolContainerProvider:c => c.GetMember("C")),
SemanticEdit(SemanticEditKind.Insert,c => c.GetMember("C.D")),},
capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType);}
The text was updated successfully, but these errors were encountered:
When a property shadows primary constructor parameter and the property is renamed/deleted, the calls to this property from within the instance members of the type will currently throw MethodMissingException.
We could update all the methods to access the primary constructor, or do so from the deleted property.
Test in TopLevelEditingTests.cs
The text was updated successfully, but these errors were encountered: