Giter Club home page Giter Club logo

Comments (5)

stakx avatar stakx commented on June 30, 2024

This might be really difficult, if not impossible, to figure out, especially without a minimally complete and verifiable code example for reproduction.

System.Security.VerificationException: Method IEntityResolver.ResolveAsync: type argument 'TResult' violates the constraint of type parameter 'TEntity'.

Where does TResult come from? And do you have any way of figuring out exactly what concrete type TResult is? Is it possible that you are providing an incompatible type argument (say, via Reflection), and the bug is in fact not in DynamicProxy or the CoreCLR, but in your own code?

from core.

dario-hd avatar dario-hd commented on June 30, 2024

@stakx thanks a lot for the answer! That's true, this looks like a challenge!

Interestingly enough, TResult is not involved in this interface as well as in the implementation of the interface. BUT, we have other classes with such argument.

If there would be a bug I would expect the exception to be thrown quite consistently and stopping the "fault" container and stating a new one would not fix the issue, or? It seems that there is something wrong going on at startup somehow.

As mentioned previously, we will try to figure out more, but in the meanwhile, I thought of posting it here. Maybe nothing is wrong in Castle.Core and Autofac is doing something out of our control? To be figured out.

from core.

maxcherednik avatar maxcherednik commented on June 30, 2024

Similar issue here: FakeItEasy/FakeItEasy#1910 (comment)

So far I managed to see the pattern in failing. When it fails, the method definition of the generated type looks different from the interface.

from core.

gokhanabatay avatar gokhanabatay commented on June 30, 2024

Hi @stakx
We have the same issue with castle core dynamic proxy.

System.TypeLoadException: GenericArguments[0], 'T', on 'Castle.Proxies.Invocations.IProfileMapService_AssingProfile[T]' violates the constraint of type parameter 'T'.
   at Castle.Proxies.IProfileMapServiceProxy.AssingProfile[T](AssignProfileRequest assignProfileRequest)

  at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at lambda_method17752(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
public interface IProfile
{
    string Code { get; set; }
}

public class FeeProfile : IProfile
{
    public string Code { get; set; }
}

public class AssignProfileRequest
{
    public virtual string AccountNo { get; set; }

    public virtual string ProfileCode { get; set; }
}

public interface IProfileMapService 
{
    void AssingProfile<T>(AssignProfileRequest assignProfileRequest) where T : IProfile;
}

public class ProfileMapService : IProfileMapService
{
    public void AssingProfile<T>(AssignProfileRequest assignProfileRequest) where T : IProfile
    {
         //Query type T entity, assign profile to member
    }
}

from core.

stakx avatar stakx commented on June 30, 2024

@gokhanabatay – same in your case, without a minimally complete and verifiable code example that actually reproduces the exception, there's not much we can do.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.