TypeLoadException was unhandled by user code

2 posts, 0 answers
  1. Joel
    Joel avatar
    19 posts
    Member since:
    Dec 2011

    Posted 10 Jun 2013 Link to this post

    Couldn't figure out why this is happening.

    System.TypeLoadException was unhandled by user code
      Message=Method 'InternalToString' on type 'HttpEntityExceptionProxy+644d129a7a854c8c9d115708bc631cd4' from assembly 'Telerik.JustMock.Dynamic, Version=, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly.
           at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
           at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
           at System.Reflection.Emit.TypeBuilder.CreateType()
           at    .   .   ()
           at Telerik.JustMock.DynamicProxy.Proxy.   ()
           at Telerik.JustMock.DynamicProxy.ProxyFactory.Create()
           at Telerik.JustMock.DynamicProxy.Fluent.FluentProxy.NewInstance()
           at Telerik.JustMock.DynamicProxy.Proxy.Create(Type type, Action`1 action)
           at    .   .   (Type   ,      )
           at    .   .   (     )
           at    .   .   (Behavior    , Boolean    )
           at    .   .   ()
           at Telerik.JustMock.FluentMock.Create()
           at Telerik.JustMock.Mock.Create(Type target, Action`1 settings)
           at Telerik.JustMock.Mock.Create(Type targetType, Constructor constructor, Behavior behavior)
           at Telerik.JustMock.Mock.Create[T](Constructor constructor)
           at Tests.HttpEntityExceptionExtensions_GetExceptionMessage_with_null_Response_returns_null() in c:\HttpEntityExceptionExtensionsTests.cs:line 34

    // works fine.
    var test = Mock.Create<HttpRequestException>(Constructor.Mocked);
    // throws exception
    var exception = Mock.Create<HttpEntityException>(Constructor.Mocked);
    // HttpRequestException is from NuGet Package Microsoft.Net.Http.2.1.10
    public class HttpEntityException : HttpRequestException
        public HttpEntityException(HttpResponseMessage response)
            : base(response.ReasonPhrase)
            this.Response = response;
        public HttpStatusCode StatusCode { get { return this.Response.StatusCode; } }
        public HttpResponseMessage Response { get; private set; }

    Currently have JustMock_2013.2.603_Dev.msi installed.

  2. Kaloyan
    Kaloyan avatar
    880 posts

    Posted 11 Jun 2013 Link to this post

    Hello Joel,

    Thank you for reaching our forums.

    Please, make sure you have updated the Telerik.JustMock.* DLLs (inside your test projects) after the installation of our latest internal build (JustMock_2013.2.603_Dev).

    I hope this solves the issue.

    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