System.TypeAccessException

3 posts, 0 answers
  1. Taliesin
    Taliesin avatar
    2 posts
    Member since:
    Nov 2010

    Posted 29 Nov 2010 Link to this post

    Hi, I'm trying to evaluate JustMock for the team. Trying to convert some Moq tests to JustMocks and I'm getting an error like:

    Test method Implementation.Test.HealthCheckHandlerTest.active_endpoints_returns_results_using_JustMock threw exception:
    System.TypeAccessException: Attempt by method 'PrivateApiProxy_Interceptor_38cce20ce0d04bd6b91832ef4a05927c.Intercept(Implementation.PrivateApiAccess.PrivateApiProxy, Boolean ByRef)' to access type 'System.Collections.Generic.IEnumerable`1<Implementation.PrivateApiAccess.PrivateApiResponse>' failed.

    Strangely, although I initialized them as strict, the calls seem to be falling through into the implementation.

    I'm in a bit of a hurry, so I've simply remove some of the namespaces to protect the inocent. Can you tell me what I might be doing wrong to recieve this error. I may be able to write something stand alone that I can share, but it is annoying when you get an unhandle exception from the framework.
  2. Taliesin
    Taliesin avatar
    2 posts
    Member since:
    Nov 2010

    Posted 30 Nov 2010 Link to this post

    OK, once I figured out why a TypeAccessException was being thrown (I was trying to return an internal type using the .Returns(Tresult result) method,  it was relatively easy to track the following solution down:

    http://www.telerik.com/help/justmock/basic-usage-mock-internal-types-via-proxy.html

    Would be nice if it would throw something that pointed to the issue, but it is no worse than Moq in this regard.
  3. DevCraft R3 2016 release webinar banner
  4. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 30 Nov 2010 Link to this post

    Hi Taliesin,

    Thanks for sending the issue. Glad that you have worked it out. However, i am adding an PITS issue for throwing friendly exception when returning an internal type.

    You can track the progress of the task here:
    http://www.telerik.com/support/pits.aspx#/public/justmock/4183

    Please feel free to write back for any issues you face.

    Kind Regards,
    Ricky
    the Telerik team
    Browse the videos here>> to help you get started with JustMock
Back to Top