Add some error handling.
Refactor metric provider base code.
Initial implementation of the .NET metric provider.