Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventBroker: UI Thread Subscriber doesn't seem to switch to the UI Thread #9

Open
GoogleCodeExporter opened this issue Feb 17, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Write a subscriber something along the following
[EventSubscription(EventTopics.MyEvent, 
typeof(bbv.Common.EventBroker.Handlers.UserInterface))]
Where you are asking the eventbroker to run in the UI thread

2.
Write an Event publisher that generates the event
[EventPublication(EventTopics.MyEvent)]
        public event EventHandler AnEvent;

What is the expected output? What do you see instead?
The expected is that the delegate will run in the UI thread.. .instead it runs 
in the event broker's thread and causes an exception


What version of the product are you using? 
Current as of 2/27/2011
On what operating system?
Windows XP


Please provide any additional information below.

It appears the method in userinterface.cs below does not do as intended:

Thanks

private Exception CallWithThreadSwitch(Delegate subscriptionHandler, object 
sender, EventArgs e)
        {
            Exception exception = null;

            this.syncContextHolder.SyncContext.Send(
                delegate(object data)
                    {
                        try
                        {
                            ((Delegate)data).DynamicInvoke(sender, e);
                        }
                        catch (TargetInvocationException ex)
                        {
                            exception = ex;
                        }
                    },
                subscriptionHandler);

            return exception;
        }

Original issue reported on code.google.com by [email protected] on 3 Mar 2011 at 7:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant