Link to home
Start Free TrialLog in
Avatar of ACanadian
ACanadian

asked on

Exception thrown when filling a dataset table


H Gurus,

I am attempting to optimize my application.  I found a great article through Experts Exchange and it talks about how expensive exceptions are to your application. Especially the ones you don't know about.  So I followed its points on how to identify those hidden exceptions using Perfmon and the debugger.  It seems that every time I fill a datatable from a data adapter an exception is being thrown.

eg:

daOrderCategories.Fill(ds.tblOrderCategories_SelectAll);
Generates Exception: "Specified argument was out of the range of valid values."

I am wondering what the cause of this could be, because these exceptions are not breaking the application. Just slowing it down.

Any thoughts?

ACanadian
Avatar of gregasm
gregasm

have you seen the stacktrace?

wrap the code in a try catch block and examine the stacktrace.
Avatar of ACanadian

ASKER

Do you mean the 'Call Stack' tab within Visual Studio .net in debug mode?

I have the code wrapped in a try catch block.
intresting ... its happenning internally being handled and continuing ... can you put up your full code maybe one of your arguments is causing it ?

It looks to me like the framework itself is throwing and handling an exception (not a whole lot you can do about that) ...


Yes I thinks that is whats happening, I was just wondering if there is a way I can fix that.  

I want to minimize the number of exceptions being thrown. My own and ones the occurr within the framework.
Call the code, and then catch the exception. Print the contents of the exception object's stacktrace property. Would you paste the stacktrace here?

Thanks.
most likely you cannot fix it unless you are causing it through odd but handled data ....


How can I catch the exception if it is being handled by the frame work.

Here is what my method looks like

try
{

daOrderCategories.Fill(ds.tblOrderCategories_SelectAll);

}
catch(Exception ex)
{
   //Handling code...
}
Here is some more information:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll

Additional information: Specified argument was out of the range of valid values.
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
really? I just wanted to make sure that I wasn't missing the boat while trying to optimize my app.

Thanks

its one of the trade offs of the framework's huge benfits, you lose a bit of control :(