Skip to content

Commit f4ea050

Browse files
[release/10.0] Add property and event parent lookup table entries in AddPropertyToPropertyMap and AddEventToEventMap (#125742)
Backport of #125536 to release/10.0 /cc @tommcdon ## Customer Impact - [x] Customer reported - [ ] Found internally Multiple successive edits to an ASP.NET Core Project, esp. both cshtml or cs, results in an unhandled `ArgumentOutOfRangeException` on the target application. This issue has been reported by customer on #125534 (which was copied from Visual Studio feedback item [Hot Reload: Token id is not valid in the scope of module System.ModuleHandle](https://developercommunity.visualstudio.com/t/Hot-Reload:-Token-id-is-not-valid-in-t/10973525)) and dotnet/sdk#48182. ## Regression - [x] Yes - [ ] No Regressed in .NET 9 according to dotnet/sdk#48182 ## Testing Internal Visual Studio testing has been updated to cover this scenario ## Risk Low Co-authored-by: Tom McDonald <tommcdon@microsoft.com>
1 parent 87494dc commit f4ea050

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/coreclr/md/enc/metamodelrw.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4903,6 +4903,14 @@ CMiniMdRW::AddPropertyToPropertyMap(
49034903
IfFailGo(AddChildRowIndirectForParent(TBL_PropertyMap, PropertyMapRec::COL_PropertyList,
49044904
TBL_PropertyPtr, pmd, &pPtr));
49054905
hr = PutCol(TBL_PropertyPtr, PropertyPtrRec::COL_Property, pPtr, pd);
4906+
4907+
// Add the <property, typedef> to the property parent lookup table.
4908+
// This mirrors what AddMethodToTypeDef/AddFieldToTypeDef do for their
4909+
// respective lookup tables, and what emit.cpp:DefineProperty does.
4910+
PropertyMapRec *pPropertyMapRec;
4911+
IfFailGo(GetPropertyMapRecord(pmd, &pPropertyMapRec));
4912+
IfFailGo(AddPropertyToLookUpTable(TokenFromRid(pd, mdtProperty),
4913+
getParentOfPropertyMap(pPropertyMapRec)));
49064914
}
49074915

49084916

@@ -4930,6 +4938,14 @@ CMiniMdRW::AddEventToEventMap(
49304938
IfFailGo(AddChildRowIndirectForParent(TBL_EventMap, EventMapRec::COL_EventList,
49314939
TBL_EventPtr, emd, &pPtr));
49324940
hr = PutCol(TBL_EventPtr, EventPtrRec::COL_Event, pPtr, ed);
4941+
4942+
// Add the <event, typedef> to the event parent lookup table.
4943+
// This mirrors what AddMethodToTypeDef/AddFieldToTypeDef do for their
4944+
// respective lookup tables.
4945+
EventMapRec *pEventMapRec;
4946+
IfFailGo(GetEventMapRecord(emd, &pEventMapRec));
4947+
IfFailGo(AddEventToLookUpTable(TokenFromRid(ed, mdtEvent),
4948+
getParentOfEventMap(pEventMapRec)));
49334949
}
49344950
ErrExit:
49354951
return hr;

0 commit comments

Comments
 (0)