Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: Web Api Tracing hides exception context [862]

$
0
0
I have an exception that is being thrown, but the context information for the exception is being lost in the traceAction provided to ITraceWriter.Trace(). This happens because System.Web.Http.Tracing.ITraceWriterExtensions calls traceRecord.Exception = info.Exception.GetBaseException(); to store the exception information rather than info.Exception.

The issue here is that the exception hierarchy is being destroyed. In my example, I have a formatting exception being thrown (the base exception). The message being logged is simply "The conversion cannot be performed.". The exception above that in the hierarchy provides the context that actually helps in solving the problem. For example:

CsvHelper.CsvReaderException: An error occurred reading the record.

Row: '2' (1 based)
Type: 'MyNamespace.ModelRecord'
Field Index: '1' (0 based)
Field Name: 'Timestamp'
Field Value: '25/02/2013 13:45:00'
---> System.NotSupportedException: The conversion cannot be performed.
at CsvHelper.TypeConversion.DefaultTypeConverter.ConvertFromString(CultureInfo culture, String text)
at CsvHelper.TypeConversion.DateTimeConverter.ConvertFromString(CultureInfo culture, String text)
at lambda_method(Closure , ICsvReader )
at CsvHelper.CsvReader.<GetRecords>d__0`1.MoveNext()
--- End of inner exception stack trace ---
at CsvHelper.CsvReader.<GetRecords>d__0`1.MoveNext()

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>