0

We have many WCF services, we have not been using contract first. So now we have a lot of code that throws exceptions, that are not specified in the FaultContracts.

Other than manually inspecting the code. Is there a way to generate FaultContracts or at least get a warning when a FaultContract is missing?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252

1 Answers1

-1

The Microsoft Enterprise Library Exception Handling Block has a feature which allows exceptions to be declaratively mapped to faults at the service boundary level. This means that you don't have to explicitly raise the faults yourself; they will be created for you by the block when an exception reaches a service boundary. See this article for more details.

However this won't help you identify service operations which are missing fault contracts. I'm not aware of a tool which can do this, so you may have to write your own.

pmarflee
  • 3,428
  • 20
  • 21
  • Thanks for the reply, but this would still require me to manually specify all the fault contracts, unless I have misunderstood something. – Shiraz Bhaiji Nov 02 '09 at 09:59
  • @Shiraz: Yes, that's correct. I'm not aware of a tool that will analyse code coverage for fault contracts. It's probably something you would have to write yourself using reflection. – pmarflee Nov 02 '09 at 10:59