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

TypeLoadException was unhandled by user code

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 10 Jun 2013, 07:59 PM
Couldn't figure out why this is happening.

System.TypeLoadException was unhandled by user code
  HResult=-2146233054
  Message=Method 'InternalToString' on type 'HttpEntityExceptionProxy+644d129a7a854c8c9d115708bc631cd4' 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.
  Source=mscorlib
  TypeName=HttpEntityExceptionProxy+644d129a7a854c8c9d115708bc631cd4
  StackTrace:
       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.

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 11 Jun 2013, 11:55 AM
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.

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.
Tags
General Discussions
Asked by
Joel
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or