You gotta love Mono

I’m working on a project with a cross platform aspect, so I ran my unit tests through mono for the first time today. Four tests failed, all at the same spot where my code calls Task<T>.Exception.GetBaseException(). When this code runs on the CLR, it returns Exception, but when run on Mono, it returns AggregateException, which is what the docs *say* it should do, even though the return type is Exception. I’m not sure if I should report this as a bug to the Mono team, or to MicrosoftConnect because the docs say it should return the base AggregateException (when clearly it just returns the base Exception type for *whatever* exception is down there. Regardless, I switched to a call they could both agree on:


Task<T>.Exception.InnerExceptions[0];

Now tests pass on both runtimes 🙂

Advertisements
This entry was posted in Coding and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s