Here is my problem. I'm creating an Instrumentation class that will use
previously created Performance Categories and Counters in order to time
various processes (ie. query duration etc.). This Instrumentation class
will be used by a variety of "services", so the Categories and Counters
to be used within the object must be set during object construction.
So I created a class variable array of:
private static PerformanceCoun ter[] arrayCounters = null;
I created an overloaded constructor:
public Instrumentation (string logName, string PerfCategory, string[]
PerfCounters, string CASContext)
The parameters are passed in by the consuming service, with the
PerformanceCoun ters to be tracked in the form of a string array.
Within the constructor, I process the string array and try to set the
array members of PerformanceCoun ter array:
long arrayCountersIn dex = 0;
foreach (string counter in PerfCounters)
arrayCounters[arrayCountersIn dex++] = new
PerformanceCoun ter(PerfCategor y, counter, false);
The solution builds with no errors, but as soon as the previous code
line is executed during testing I get a "System.NullRef erenceException :
Object reference not set to an instance of an object." error on the
arrayCounters object.
The constructor will work if I comment out the setting of the array and
hard code the original class variable like this:
private static PerformanceCoun ter[] arrayCounters = {new
PerformanceCoun ter("ServiceNam e", "ServiceLocatio nDuration", false),
new PerformanceCoun ter("ServiceNam e", "OracleConnecti onDuration",
false),
new PerformanceCoun ter("ServiceNam e", "QueryDuration" , false),
new PerformanceCoun ter("ServiceNam e", "WebServiceDura tion", false)};
Any help I could get with getting that constructor array to work would
be greatly appreciated.
Thanks - jimbo
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!