InvalidOperationException was unhandled by user code


I am using the Silverlight client.
It looks like that the client doesn’t handles errors with the onError parameter. Perhaps this behavior is by design.
To replicate the issue:

string Text = "";
// onMessageReceived
delegate(Subscription s, PubsubMessage message)
    Text = "SubscribeAsync ok";
// onError
delegate(Subscription s, Exception ex)
    Text = "SubscribeAsync Error : " + ex.Message;


tjanczuk wrote Nov 24, 2010 at 10:55 PM

Cristian, I am not sure what behavior you are observing vs what you expect. Is the onError delegate not called when you expect it to be called? Where is the "InvalidOperationException" from the title thrown?

CristianD wrote Nov 25, 2010 at 8:18 AM

It is correct, the onError delegate is not called.
In this case I expect Laharsub calls the onError delegate and fills variable Text with
“SubscribeAsync Error : TopicId must be a positive integer.”
But I get the unhandled error “InvalidOperationException was unhandled by user code”

The same issue happens in SubscribeAsync() with errors:
"From must be a non-negative integer."
"Cannot create subscription. Only one subscription to a given topic may be active at a time."
and in PublishAsync() with errors:
"TopicId must be a positive integer."
"ContentType must be specified."
"Body of the message to publish must be specified."

You can also replicate the issue running the Laharsub Sample ([url: http://laharsubsample.codeplex.com/|http://laharsubsample.codeplex.com/]), press “Create topic” and then “Subscribe to topic” twice.
Thanks, Cristian