upta / pubsub

An extremely light-weight, easy to use PCL pub/sub library
Apache License 2.0
219 stars 53 forks source link

System.InvalidOperationException has been thrown #30

Closed RobbiewOnline closed 4 years ago

RobbiewOnline commented 4 years ago

Hi,

I successfully upgraded from PubSub 3.1.0 to 4.0.0, but this week I un-installed the app and re-installed from scratch. During startup I received

System.InvalidOperationException has been thrown
Collection was modified; enumeration operation may not execute

Oddly it seemed to crash every time thereafter.

I tried putting in lock mutex's around all of my hub.Subscribe and hub.Publish invocations to ensure no threading issues from my end, but the problem continued.

In the end I had to revert back to PubSub 3.1.0 and then the problem went away.

Unfortunately I don't have the call stack any more, but it was deep inside PubSub with a LINQ .Where clause.

Screenshot 2019-12-15 at 17 08 08
christophedelanghe commented 4 years ago

What is the status here? I have the same problem ... is there a workaround?

gb0o commented 4 years ago

@upta Can you merge pull request https://github.com/upta/pubsub/pull/31 to fix this issue?

upta commented 4 years ago

@gb0o @christophedelanghe @devology-rob

My apologies! I completely forgot this fix was pending, then was going to do it when @christophedelanghe brought it up and got busy and forgot again :(

I'll merge the fix and update the nuget package tomorrow. Sorry about the inconvenience!

christophedelanghe commented 4 years ago

Thx! I reverted back to version 3.1.0. Wil test it again after your merge.

upta commented 4 years ago

Merged in #31 and published to Nuget as 4.0.1

Thanks guys!