Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'in' decorator on method parameters for DispatchProxy #47522

Closed
RadmirT opened this issue Jan 27, 2021 · 1 comment · Fixed by #49214
Closed

Add support for 'in' decorator on method parameters for DispatchProxy #47522

RadmirT opened this issue Jan 27, 2021 · 1 comment · Fixed by #49214

Comments

@RadmirT
Copy link

RadmirT commented Jan 27, 2021

This code:

       public interface ISample
        {
            void Foo(in int bar);
        }

        public class SampleProxy : DispatchProxy
        {
            public static ISample CreateProxy()
            {
                return DispatchProxy.Create<ISample, SampleProxy>();
            }

            protected override object Invoke(MethodInfo targetMethod, object[] args)
            {
                return null;
            }
        }

        [Test]
        public void CreateProxyTest()
        {
            var proxy = SampleProxy.CreateProxy();
        }

throws the exception

System.TypeLoadException : Signature of the body and declaration in a method implementation do not match.  Type: 'generatedProxy_1'.  Assembly: 'ProxyBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
   at System.Reflection.DispatchProxyGenerator.ProxyBuilder.CreateType()
   at System.Reflection.DispatchProxyGenerator.GenerateProxyType(Type baseType, Type interfaceType)
   at System.Reflection.DispatchProxyGenerator.GetProxyType(Type baseType, Type interfaceType)
   at System.Reflection.DispatchProxyGenerator.CreateProxyInstance(Type baseType, Type interfaceType)
   at System.Reflection.DispatchProxy.Create[T,TProxy]()
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Reflection untriaged New issue has not been triaged by the area owner labels Jan 27, 2021
@RadmirT RadmirT changed the title When a DispatchProxy nested interface have in parameters it throws TypeLoadException: Signature of the body and declaration in a method implementation do not match When a DispatchProxy nested interface have method with in parameters it throws TypeLoadException: Signature of the body and declaration in a method implementation do not match Jan 27, 2021
@buyaa-n buyaa-n added the bug label Feb 18, 2021
@joperezr joperezr added this to the Future milestone Feb 23, 2021
@joperezr joperezr changed the title When a DispatchProxy nested interface have method with in parameters it throws TypeLoadException: Signature of the body and declaration in a method implementation do not match Add support for 'in' decorator on method parameters for DispatchProxy Feb 23, 2021
@ghost ghost added the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label Feb 23, 2021
@joperezr joperezr removed needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration untriaged New issue has not been triaged by the area owner labels Feb 23, 2021
@joperezr
Copy link
Member

cc: @krwq

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 5, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 12, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants