tags:

views:

41

answers:

1

When you have a piece of software that runs an out of process COM server and the COM server crashes, will it show a message (let's say its an unhandled exception) to the user or what will happen?

Also, will the COM client crash too, knowing that this client relies on this COM Server quite a lot?

What's the behaviour in regards COM Server and COM client when an unhandled exception occurs in the server?

+3  A: 

The COM client will get RPC_E_SERVERFAULT as the HRESULT from the next COM call and all others until the server is restarted. This will not necessarily result in a crash, as long as the client checks its error codes. However, this is probably not a recoverable error for the client, so upon getting RPC_E_SERVERFAULT (or, really, any RPC_E error code), you should probably initiate a graceful exit.

JSBangs
That's not it, you'll get that return code when the server raised an unhandled exception. Very hard to deal with btw. Ought to get RPC_E_SERVERDIED. But yes, don't handle any of these errors, the client app is dead.
Hans Passant
@Hans, whether you get `RPC_E_SERVERDIED` or `RPC_E_SERVERFAULT` depends on the precise way that the server died, but the significance for the client is basically the same.
JSBangs
RPC_E_SERVERFAULT doesn't make the server die, unfortunately. Well, boring details perhaps.
Hans Passant