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
I am using the blazer server and want to notify the UI when entities change, so I need to dynamically register events.
Thread A is triggering an event, while thread B is registering or unregistering the event,
The foreach loop in thread A will prompt the error that the collection has been modified.
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
at Abp.Domain.Uow.UnitOfWorkBase.CompleteAsync()
at ZLJ.App.Admin.Equipments.EquipmentInstances.BXJGEquipmentInstanceAppService.ChangeLifeCycleStatus(BatchChangeLifetimeStatusInput input) in D:\fyj\back\src\ZLJ.Application\Equipments\EquipmentInstances\BXJGEquipmentInstanceAppService.cs:line 315
There are two ways I envision to handle it:
Lock, not advisable, performance is too low in high concurrency scenarios.
When traversing, the original collection calls ToList()
The text was updated successfully, but these errors were encountered:
Could you provide sample code to reproduce this problem ? @ismcagdas
I have encountered the same problem, attached is the console demo EventBusConsoleDemo.zip
I think this issue might be tightly related to the issue that I opened. #6726
I think if the collection of the event handlers is changed while triggering an event, this exception will be thrown.
Maybe this issue is then a duplicate
abp 8.2
I am using the blazer server and want to notify the UI when entities change, so I need to dynamically register events.
Thread A is triggering an event, while thread B is registering or unregistering the event,
The foreach loop in thread A will prompt the error that the collection has been modified.
There are two ways I envision to handle it:
The text was updated successfully, but these errors were encountered: