The loading type of the Silverlight TDD test project through reflector is abnormal.

Source: Internet
Author: User
Tags reflector

Exception message: Unable to load one or more of the requested types. Retrieve the loaderexceptions property for more information.

Mathengine is a Silverlight form project,

Mathengine. app and mathengine. mainpage are default application classes and main form classes respectively, so they contain references of system. Windows.
By default, the test project (mathenginetests) is a non-form project and does not add a reference to system. Windows.

Add reference: C: \ Program Files (x86) \ reference assemblies \ Microsoft \ framework \ Silverlight \ v4.0 \ system. Windows. dll,

This problem can be solved!

Public static ienumerable <t> createinstances <t> () {try {type basic = typeof (t); var types = Basic. assembly. gettypes (); var result = (from T in types where basic. isassignablefrom (t )&&! T. isabstract //&&! T. hasattribute <ignoreattribute> () Select (t) activator. createinstance (t )). tolist (); return result;} catch (reflectiontypeloadexception ex) {// The test project (mathenginetests) cannot be loaded: mathengine. APP and mathengine. mainpage: C: \ Program Files (x86) \ reference assemblies \ Microsoft \ framework \ Silverlight \ v4.0 \ system. windows. DLL throw ex;} catch (exception ex) {Throw ex ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.