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

Exceptions thrown from RemotingClient callbacks are swallowed as netexe #6

Open
GoogleCodeExporter opened this issue Jun 29, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Edit 
FluorineFx\Samples\Silverlight\AMFCall\SilverlightApplication\Page.xaml.cs 
to throw an exception from GetXDocumentHandler.ResultReceived()

What is the expected output? What do you see instead?
Expect to result in an exception bubbling up the call stack.
Exception is swallowed and exposed as a NetStatus event.

What version of the product are you using? On what operating system?
WinXP, VS2008, SilverLight 3, FluorineFX 1.0.0.15


Please provide any additional information below.
Silverlightut unit tests become messier when asserts thrown from the 
callback handler are swallowed.

To work around this issue, I created a callback wrapper class posts the 
actual callback work to the originating thread so call-back exceptions are 
thrown from that thread, instead of the FluorineFX callback context. Eg:
public class GenericPendingServiceCallback : IPendingServiceCallback
    {
        private Action<IPendingServiceCall> callback;
        public GenericPendingServiceCallback(Action<IPendingServiceCall> 
callback)
        {
            this.callback = callback;
        }
        public void ResultReceived(IPendingServiceCall call)
        {
            // callbacks affecting the UI should be posted to the UI 
thread, not a background thread.
            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += (o, e) =>
                {
                    callback(call);
                };
            worker.RunWorkerAsync();
        }
    }

[TestMethod]
[Asynchronous]
public void ShouldReturnFailureWhenCallingNonexistantService()
{
    connection.Call("ServiceName.ServiceMethodName",
        new GenericPendingServiceCallback((call) =>
            {
                Assert.IsFalse(call.IsSuccess);
                TestComplete();
            }));
}

Original issue reported on code.google.com by daniel.l...@gmail.com on 20 Oct 2009 at 3:53

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