how do I examine parameters in an exception?

  • Thread starter Thread starter help
  • Start date Start date
H

help

If I enable debug at C# exceptions, it dutifully breaks and shows me the stack
of called procedures. At the top (of my list) is DateTime.ParseExact() and it
does through an exception if I proceed.

But, how can I examine the parameters to that call to see what it doesn't like?

tnx,
/steveA
 
/steveA, two quick options, you can put a break point right before the call
to your exception throwing function or put some debug statements which spit
out the variables being passed.
 
/steveA, two quick options, you can put a break point right before the call
to your exception throwing function or put some debug statements which spit
out the variables being passed.

Let me be more precise. I have a dataset where I have "dynamically" constructed
a table, including a column of type System.DateTime. I then call ds.ReadXml()
to process the input. Unless code is available for this, I can't step into it,
nor do a quickwatch. If I set debug to halt on a thrown exception, the stack
shows a call to DateTime.ParseExact() on top - but there is no way to examine
the variables (I think it might be because the exception is on its way out).

Anyway, if instead, I do a table.Rows.Add( new Object[] {...} ) of the same
strings from the xml message, this works fine! gag!

Is this a feature or bug of ReadXml? I'd like to know what the other parameters
are to the ParseExact()...

/steveA
 
/steveA, if sounds like you are putting an invalid Date in your dataset.
Try removing the dates (set them to null). If that works then check the
format of your dates to make sure that they are XML compliant. If that
doesn't work post here with the results and some sample data.

--
Greg Ewing [MVP]
http://www.citidc.com

/steveA, two quick options, you can put a break point right before the call
to your exception throwing function or put some debug statements which spit
out the variables being passed.

Let me be more precise. I have a dataset where I have "dynamically" constructed
a table, including a column of type System.DateTime. I then call ds.ReadXml()
to process the input. Unless code is available for this, I can't step into it,
nor do a quickwatch. If I set debug to halt on a thrown exception, the stack
shows a call to DateTime.ParseExact() on top - but there is no way to examine
the variables (I think it might be because the exception is on its way out).

Anyway, if instead, I do a table.Rows.Add( new Object[] {...} ) of the same
strings from the xml message, this works fine! gag!

Is this a feature or bug of ReadXml? I'd like to know what the other parameters
are to the ParseExact()...

/steveA
 
Back
Top