Open-Systems-Pharmacology / MoBi

MoBi® is a software tool for multiscale physiological modeling and simulation
Other
31 stars 10 forks source link

Exception "Sequence contains no matching element" - simulations are gone #1476

Closed VanessaBa closed 3 months ago

VanessaBa commented 3 months ago

When selecting more than one module it is possible to delete these modules, even if they are used by a simulation. This causes the above exception most of the simulations are gone or cannot be opened anymore.

Fix proposal: It should not be possible to delete the modules as long as they are used in a simulation ;-)

Exception details:

Application: MoBi® 12.0.294

Sequence contains no matching element

Stack trace:

at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
  at MoBi.Core.Services.TemplateResolverTask.TemplateBuildingBlockFor[TBuildingBlock](TBuildingBlock buildingBlock)
  at MoBi.Presentation.Tasks.Interaction.InteractionTasksForSimulation.TemplateBuildingBlockFor[TBuildingBlock](TBuildingBlock buildingBlock)
  at MoBi.Presentation.MenusAndBars.ContextMenus.ContextMenuForSimulation.hasChanges(IBuildingBlock simulationBuildingBlock)
  at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
  at MoBi.Presentation.MenusAndBars.ContextMenus.ContextMenuForSimulation.InitializeWith(ObjectBaseDTO dto, IPresenter presenter)
  at MoBi.Presentation.MenusAndBars.ContextMenus.ContextMenuSpecificationFactoryForSimulation.CreateFor(IViewItem viewItem, IPresenterWithContextMenu`1 presenter)
  at OSPSuite.Presentation.Presenters.ContextMenus.ContextMenuFactory`1.CreateFor(TObjectRequestingContextMenu objectRequestingContextMenu, IPresenterWithContextMenu`1 presenter)
  at MoBi.Presentation.Presenter.Main.ExplorerPresenter`2.ContextMenuFor(IViewItem viewItem)
  at MoBi.Presentation.Presenter.Main.SimulationExplorerPresenter.ContextMenuFor(ITreeNode treeNode)
  at MoBi.Presentation.Presenter.Main.ExplorerPresenter`2.NodeDoubleClicked(ITreeNode node)
  at OSPSuite.UI.Views.BaseExplorerView.<>c__DisplayClass16_0.<nodeDoubleClick>b__0()
  at OSPSuite.Utility.Extensions.ExceptionExtensions.DoWithinExceptionHandler(Object callerObject, Action actionToExecute)
rwmcintosh commented 3 months ago

@VanessaBa closing in favor of #1464. These are probably the same, thanks for the steps to reproduce!