Debug OData “Unable to load one or more of the requested types” / failure to load types

Found at http://connect.microsoft.com/VisualStudio/feedback/details/541962/unable-to-load-one-or-more-of-the-requested-types-connected-with-entitydatasource in the mist of the discussion, adding this code to the application allows to see the details of the exception:

foreach (var asm in
AppDomain.CurrentDomain.GetAssemblies())
{
asm.GetTypes();
}

This is quite useful because otherwise you get the exception as this text in the browser (IE)  trying to load the page:

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]

Except that of course in the browser you can’t look the LoaderExceptions property, thus the need to repro under a debugger.

This entry was posted in Computers and Internet, Microsoft, Ordinateurs et Internet, Travail, work. 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