This is a migrated thread and some comments may be shown as answers.

System.TypeAccessException

2 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Taliesin
Top achievements
Rank 1
Taliesin asked on 29 Nov 2010, 08:44 PM
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 Answers, 1 is accepted

Sort by
0
Taliesin
Top achievements
Rank 1
answered on 30 Nov 2010, 10:40 AM
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.
0
Ricky
Telerik team
answered on 30 Nov 2010, 11:39 AM
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
Tags
General Discussions
Asked by
Taliesin
Top achievements
Rank 1
Answers by
Taliesin
Top achievements
Rank 1
Ricky
Telerik team
Share this question
or