FIX: "System.InvalidOperationException: Category does not exist" error if some registry keys for the WCF-based SAP adapter are corrupted in BizTalk Adapter Pack

Applies to: BizTalk Adapters

This article applies to the following product:
  • BizTalk Adapter Pack 2.0
  • BizTalk Adapter Pack 2010

Symptoms


Consider the following scenario:
  • You use Microsoft Windows Communication Foundation (WCF)-based SAP adapter in Microsoft BizTalk Adapter Pack 2.0 or in Microsoft BizTalk Adapter Pack 2010 to send requests to an SAP system.

    Note The WCF-based SAP adapter is also known as Microsoft BizTalk Adapter for mySAP Business Suite 3.0.
  • Some registry keys of the WCF-based SAP adapter performance counters are corrupted.
In this scenario, you receive the following error message:
System.TypeInitializationException: The type initializer for 'Microsoft.Adapters.SAP.SapPerfCounters' threw an exception. ---> System.InvalidOperationException: Category does not exist.
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounterCategory.CounterExists(String counterName, String categoryName, String machineName)
at System.Diagnostics.PerformanceCounterCategory.CounterExists(String counterName, String categoryName)
at Microsoft.Adapters.SAP.SapPerfCounters..cctor()

Cause


This issue occurs because the WCF-based SAP adapter does not handle the InvalidOperationException exception.

Resolution


Cumulative update information

For BizTalk Adapter Pack 2010

The hotfix that resolves this issue is included in cumulative update package 2 for BizTalk Adapter Pack 2010. For more information about how to obtain this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:


2572999 Cumulative update package 2 for BizTalk Adapter Pack 2010

BizTalk Adapter Pack 2.0

A hotfix is available to resolve this issue. This hotfix is available individually and is included in Cumulative Update 3 for BizTalk Adapter Pack 2.0.

For more information about how to obtain the cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
2557150 Cumulative update package 3 for BizTalk Adapter Pack 2.0

References


For more information about BizTalk Server hotfixes, click the following article number to view the article in the Microsoft Knowledge Base:

2003907 Information about BizTalk Server hotfixes

For more information about performance counters, visit the following MSDN website: