A first chance exception of type 'System.InvalidOperationException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I get the following error:
'A first chance exception of type 'System.InvalidOperationException'
occurred in system.dll

Additional information: The requested Performance Counter is not a custom
counter, it has to be initialized as ReadOnly.'


My code c#:
using Microsoft.Practices.EnterpriseLibrary.Data;
....
private DataSet ds;
private Database db;
db = DatabaseFactory.CreateDatabase();
string sqlCommand = "Select...";
DBCommandWrapper dbCommandWrapper = db.GetSqlStringCommandWrapper(sqlCommand);
ds = db.ExecuteDataSet(dbCommandWrapper);

Any ideas??? Thank you in advance.
 
Hi,

My guess is that you compile the enterprise library with performance
counters enabled and that you fail to perform some required action to
install those counters on your system. I vaguely remember there is a
compiler variable that enables or disables the use of performance counters
in Enterprise Library.
 
Dmytro, you are right!

After your reply, i found this post:
http://dotnetjunkies.com/WebLog/sskokku/archive/2005/03/25/61376.aspx

I hope it was usefull for people.

Regards,

Dmytro Lapshyn said:
Hi,

My guess is that you compile the enterprise library with performance
counters enabled and that you fail to perform some required action to
install those counters on your system. I vaguely remember there is a
compiler variable that enables or disables the use of performance counters
in Enterprise Library.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Juanjo said:
Hi all

I get the following error:
'A first chance exception of type 'System.InvalidOperationException'
occurred in system.dll

Additional information: The requested Performance Counter is not a custom
counter, it has to be initialized as ReadOnly.'


My code c#:
using Microsoft.Practices.EnterpriseLibrary.Data;
...
private DataSet ds;
private Database db;
db = DatabaseFactory.CreateDatabase();
string sqlCommand = "Select...";
DBCommandWrapper dbCommandWrapper =
db.GetSqlStringCommandWrapper(sqlCommand);
ds = db.ExecuteDataSet(dbCommandWrapper);

Any ideas??? Thank you in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top