Mocking troubles

4 posts, 0 answers
  1. Sergii
    Sergii avatar
    2 posts
    Member since:
    Jan 2013

    Posted 27 May 2013 Link to this post

    HI,

    I tried to create mock of difficult custom type, but I always have an exception like
    System.TypeLoadException: System.TypeLoadException: Method 'UnloadRecursive' on type 'BaseProxy+...' from assembly 'Telerik.JustMock.Dynamic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly..

    I tried to use attribute InternalsVisibleTo like <Assembly: InternalsVisibleTo("Telerik.JustMock.Dynamic")> but it didn't solve the problem. I tried to create mock of parent types, all fine. I tried to use MockingContainer, but this no matter, because our type haven't external dependencies. I can't to find where the problem.

    What you can to suggest me?


    Thanks
  2. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 28 May 2013 Link to this post

    Hi Sergii,

    Thank you for contacting Telerik support.

    To mock non-public members, you may need to add InternalsVisibleTo attribute as follows:
    • For projects different from Silverlight:
      [assembly: InternalsVisibleTo("Telerik.JustMock, PublicKey=0024000004800000940000000602000000240000525341310004000001000100098b1434e598c6" +
      "56b22eb59000b0bf73310cb8488a6b63db1d35457f2f939f927414921a769821f371c31a8c1d4b" +
      "73f8e934e2a0769de4d874e0a517d3d7b9c36cd0ffcea2142f60974c6eb00801de4543ef7e93f7" +
      "9687b040d967bb6bd55ca093711b013967a096d524a9cadf94e3b748ebdae7947ea6de6622eabf" +
      "6548448e")]
    • For Silverlight projects:
      [assembly: InternalsVisibleTo("Telerik.JustMock")]

    Please, contact us further if you need more assistance.

    Regards,
    Kaloyan
    Telerik
    Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
  3. DevCraft R3 2016 release webinar banner
  4. Sergii
    Sergii avatar
    2 posts
    Member since:
    Jan 2013

    Posted 28 May 2013 Link to this post

    Hi Kaloyan,

    Unfortunately your advice didn't help me. But after update of JustMock all work well.
    Thanks
  5. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 28 May 2013 Link to this post

    Hi again Sergii,

    It is good to hear your issue is solved now.

    Please, do not hesitate to contact us again if you need help with anything else.

    Regards,
    Kaloyan
    Telerik
    Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Back to Top