locked
how to configure a test project for a project that depends on the Enterprise Library RRS feed

  • Question

  • I have a WinForms project that depends on the Enterprise Library. In particular, it has code like:

        Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "Log Only Policy")

    I also have a test project, with some unit tests. The tests fail when they hit the line above, with an exception like:

      Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException: The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, Log Only Policy]) failed: Object reference not set to an instance of an object. (Strategy type Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy, index 2)... [rest omitted]

    ... when I add an app.config to the test project (hoping to fix the problem), I get this result:

    Testing started:

    Exception:
    Message: Unable to cast transparent proxy to type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.AssemblyEnumerator'.
    Source: Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip
    StackTrace:
       at Microsoft.VisualStudio.TestTools.TestTypes.Unit.AppDomainIsolatedHost.CreateEnumerator(String assemblyFileName, TestRunConfiguration testRunConfiguration, ObjectHandle& assemblyResolverWrapper)
       at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAttributeEnumerator.Read(ITestTypeExtensionClientSidesProvider provider, IWarningHandler warningHandler, String assemblyFileName, ProjectData projectData, TestRunConfiguration testRunConfiguration)
       at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestTip.Load(String assemblyFileLocation, ProjectData projectData, IWarningHandler warningHandler)
       at CR_VSTesting.Executor.EnumerateTests(String assemblyFile)
       at CR_VSTesting.Executor.FindTestElements(String assemblyPath)
       at CR_VSTesting.Executor.Execute(ExecuteTestData data)
    No tests found.

    When I run the original project I don't get the problem, the exception logging seems to work.

    Monday, December 3, 2012 8:56 PM

All replies

  • Hello Dingburger,

    Thank you for posting in the MSDN forum.

    Since it is hard for us to repro this issue, maybe you could share us a sample, we try to run it in our PC. Please attach your Visual Studio test project and Winforms project, you can upload it to the sky drive, and then share the download link in your post.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Amanda Zhu Tuesday, December 11, 2012 8:20 AM
    Tuesday, December 4, 2012 3:30 AM
  • I don't know how to: "Please attach your Visual Studio test project and Winforms project, you can upload it to the sky driver, and then share the download link in your post." -- what is "the sky driver"?
    Tuesday, December 4, 2012 4:19 PM
  • Hello DingBurger,

    Sorry for "Sky Driver". What I mean  should be Sky Drive. This is the SkyDrive login website:

    http://skydrive.com/

    Or https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1354674408&rver=6.2.6289.0&wp=MBI_SSL_SHARED&wreply=https:%2F%2Fskydrive.live.com%2F%3Flc%3D1033&lc=1033&id=250206&mkt=en-US&cbcxt=sky

    You assign your Microsoft account (such as MSN account) then you can login into your own SkyDrive.

    In addition, I am trying to involve someone familiar with this topic to further look at your issue. There might be some time delay. Appreciate your patience.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.




    • Edited by Amanda Zhu Tuesday, December 11, 2012 8:20 AM
    Wednesday, December 5, 2012 2:41 AM
  • Hi,

    Can you please provide me a sample repro of the problem and send it to me via email: dmittal@microsoft.com

    Also, did you check installing enterprise library in your test environment?

    Thanks,

    Deepak


    Deepak Mittal

    Tuesday, December 11, 2012 7:35 AM
  • Hi dingburger,

    Do you have any update based on my previous comment.

    Thanks,

    Deepak




    Deepak Mittal

    Friday, December 14, 2012 1:58 PM
  • Hi dingburger,

    As I havent received any update you, I'll closing this thread for now, if you need  further assistance, please feel free to reply and we will take it further.

    Thanks,

    Deepak

    Deepak Mittal

    Monday, December 17, 2012 6:04 AM