Bug 12451 - InvalidCastException (in DEBUG mode) doesn't give as much info as MS.NET
Summary: InvalidCastException (in DEBUG mode) doesn't give as much info as MS.NET
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2013-05-29 06:36 UTC by Andres G. Aragoneses
Modified: 2013-05-29 19:27 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Andres G. Aragoneses 2013-05-29 06:36:52 UTC

Unhandled Exception: System.AggregateException: One or more errors occurred. ---
> System.InvalidCastException: Unable to cast object of type 'System.DBNull' to
type 'System.String'.
   at SevenDigital.Inbox.Backfill.Repositories.TrackRepository.GetAll(IEnumerabl
e`1 shopProductTracks) in c:\dev\lockerTeam\sevendigital-inbox-backfill\src\Seve
nDigital.Inbox.Backfill\Repositories\TrackRepository.cs:line 90

In Mono:

Unhandled Exception:
System.AggregateException: One or more errors occured ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at SevenDigital.Inbox.Backfill.Repositories.TrackRepository.GetAll (IEnumerable`1 shopProductTracks) [0x00000] in <filename unknown>:0
Comment 1 Zoltan Varga 2013-05-29 11:22:32 UTC
This has some performance costs, so its not enabled by default.  Try running with --debug=casts.
Comment 2 Andres G. Aragoneses 2013-05-29 12:08:28 UTC
Shouldn't it be already available with --debug? (Because debug is anyway already slower than non debug)
Comment 3 Zoltan Varga 2013-05-29 19:26:12 UTC
--debug only slows down JITting, --debug=casts slows down execution.
Comment 4 Andres G. Aragoneses 2013-05-29 19:27:04 UTC
I see.

What about giving a hint about "--debug=casts" in the exception message?