Unable to cast object of type 'System.Collections.Generic.List`1[MYTYPE] to accessor variant

Answered Unable to cast object of type 'System.Collections.Generic.List`1[MYTYPE] to accessor variant

  • lundi 16 avril 2012 08:51
     
     

    I'm having an issue with the unit test of a private function that returns a list of a class that I changed.

    Everything worked just fine until I removed a property and now Visual Studio will not cast the new type to the accessor variant.

    I tried everything I could find. Added the InternalsVisibleTo attribute, recreated the test method, removed all files I could find that could have cached the old class. Clicked the create private accessor option and referenced the assembly (I noticed the old property was still visible in the assembly in the references list).

    It is driving me crazy. Should it not just recreate the accessor if I change someting?

Toutes les réponses

  • mercredi 18 avril 2012 02:31
    Modérateur
     
     Traitée

    Hi Robert,

    Thank you for posting in the MSDN forum.

    I try to create a simple unit test for a private class method, then I just change the class method name, if we want run the unit test, we need to change the class method name in the unit test method manually.

    As my understanding, if we change code in our class method, we need to change something in our unit test method. The previous test method and the private .accessor couldn’t be changed automatically. Or you could try to create a new unit test for your new class method, and then check the two methods. I think you will get useful information.

    Since I’m not very sure about your app, if it is not clear, I suggest you could share us your project, then we will try to check it in our computer.

    If there's any concern, please feel free to let us know.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • lundi 23 avril 2012 05:27
    Modérateur
     
     

    Hi Robert,

    I am writing to check the status of the issue on your side. 

    What about this problem now?

    Would you mind letting us know the result of the suggestion?

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us