Reputation: 5836
I'm sure this must have been asked and answered, but I can't find it...
I have a WCF service with this interface:
[ServiceContract(Namespace = WcfNamespace.MyNamespace)]
public interface ILogging
{
[OperationContract(IsOneWay = true)]
void LogInfo(string message);
}
In my (.NET 3.5) client application, I want to ignore any failure that happens during the call to LogInfo
and I don't want to block, not even on the network transport.
Therefore, I'm thinking I should use one of the async patterns in my client. However, I can't figure out if there is any difference in how "ignore-the-result-friendly" the "event-based" or the "begin-end" patterns are. Is there a difference in this sense?
Or do you always have to implement a completed event or call End*
anyway in order to not leak resources? (I vaguely recall reading something like that by either Skeet or Lippert)
Upvotes: 1
Views: 300
Reputation: 87238
You don't need to implement any *Completed
events if you're using the event-based async pattern, so that's an option. If you use the begin/end pattern, you should call the End*
operation, and wrap it in a try/empty catch if you want to really ignore anything.
Upvotes: 2