Creating an unowned CmPossibilityList issues no PropChanged
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Iniziare da UnitOfWorkService.cs, Virtuals.cs, CmObject.cs e FactoryAdditions.cs, confrontando le implementazioni delle notifiche virtuali di LexEntry e Text con il percorso CreateUnowned. Seguire SetDefaultValuesAfterInit e OnBeforeObjectDeleted, inclusi i guard di bootstrap, quindi verificare che la creazione o l’eliminazione di una CmPossibilityList senza proprietario produca la notifica PropChanged prevista e che venga utilizzato il percorso di inizializzazione di Factory senza proprietario.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Gap
IUnitOfWorkService.RegisterObjectAsCreated (src/SIL.LCModel/Infrastructure/Impl/UnitOfWorkService.cs:583) records creation as an LcmStateChangeObjectCreation (src/SIL.LCModel/Infrastructure/Impl/LcmStateChangingClasses.cs:279). That class derives from LcmStateChangeBase and does not implement ILcmPropertyChanged. UnitOfWork.GetPropChangeInformation (src/SIL.LCModel/Infrastructure/Impl/UnitOfWork.cs:621) yields only from actions that implement ILcmPropertyChanged, so object creation by itself produces no ChangeInformation.
For an owned object the PropChanged arrives from the owning property's LcmVectorPropertyChanged / LcmAtomicRefPropertyChanged. An unowned object has no owning property, so no IVwNotifyChange.PropChanged is issued at all. This is the open TODO at UnitOfWorkService.cs:599:
// (TODO: What needs to be done for unowned objects?)
ICmPossibilityListFactory.CreateUnowned (src/SIL.LCModel/DomainImpl/FactoryAdditions.cs:1560) hits this. The new CmPossibilityList is registered in the IdentityMap, is returned by ICmPossibilityListRepository.AllInstances(), and is persisted as a UOW newbie — but no client receives a PropChanged, so nothing that caches a view of the lists is told to reload.
Proposed fix
Apply the pattern already used for the other unowned classes:
LexEntry.RegisterVirtualsModifiedForObjectCreation(src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs:854) →Virtuals.LexDbEntriesText.RegisterVirtualsModifiedForObjectCreation/...ForObjectDeletion(src/SIL.LCModel/DomainImpl/OverridesLing_Wfi.cs:1713and:1746) →Virtuals.LangProjTexts
-
Add a
Virtualsaccessor forLangProject.AllPossibilityLists, which already exists as a virtual property (src/SIL.LCModel/DomainImpl/OverridesLangProj.cs:83, declared[VirtualProperty(CellarPropertyType.ReferenceCollection, "CmPossibilityList")]). Model it onVirtuals.LangProjTexts(src/SIL.LCModel/DomainImpl/Virtuals.cs:205). -
On
CmPossibilityList, overrideRegisterVirtualsModifiedForObjectCreationandRegisterVirtualsModifiedForObjectDeletion(src/SIL.LCModel/DomainImpl/CmObject.cs:1758and:1769) to calluow.RegisterVirtualCollectionAsModifiedfor that flid onCache.LangProject, and invoke them fromSetDefaultValuesAfterInit/OnBeforeObjectDeletedthe wayTextdoes. -
Make
CmPossibilityListFactory.CreateUnownedcall((ICmObjectInternal)result).InitializeNewOwnerlessCmObjectWithPresetGuid()before returning, matching the generated ownerlessCmPossibilityListFactory.Create(Guid)(src/SIL.LCModel/DomainImpl/GeneratedFactoryImplementations.cs:320-327). Without this,SetDefaultValuesAfterInitnever runs on theCreateUnownedpath and the hook added in step 2 would not fire.
ChangeReconciler.ReconcileForeignChanges already calls RegisterVirtualsModifiedForObjectCreation on each foreign newby (src/SIL.LCModel/Infrastructure/Impl/ChangeReconciler.cs:212), so step 2 also covers Send/Receive and second-window reconciliation.
Note that SetDefaultValuesAfterInit also runs during bootstrap and data migration, where Cache.LangProject may not be resolvable; LexEntry and Text carry the same exposure, so follow whatever guard they rely on.
Out of scope
Custom field metadata is a separate mechanism with no notification path at all: LcmMetaDataCache.AddCustomField / UpdateCustomField / DeleteCustomField mutate m_metaFieldRecords in place, and FieldDescription.UpdateCustomField registers affected objects as modified but registers no metadata change. Clients must continue to be notified manually after adding a custom field.
- Lingua principale
- C#
- Stelle
- 3
- Fork
- 15
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sillsdev/liblcm
-
DeepWiki-found bugsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
License mismatchAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
-
Enable Nullable reference typesForse di nuovo libera @hahn-kev l’ha presa 107 giorni fa e non c’è nessuna pull request aperta. Apertaengineering
Tutte le issue di sillsdev/liblcm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sebastienros/jint#4282 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
pyrevitlabs/pyRevit#3792 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
I maintainer di solito rispondono entro 1 giorno
-
Update the about pageAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
fboucher/2d6-dungeon-app#256 ·
I maintainer di solito rispondono entro 1 giorno
-
area: design documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
eyalgolan/statecraft-israel#883 ·
I maintainer di solito rispondono entro 1 giorno