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

[Reflection] Event accessors don't inherit ReflectedType #10277

Closed
MaximLipnin opened this issue Aug 24, 2018 · 0 comments

Comments

@MaximLipnin
Copy link
Collaborator

@MaximLipnin MaximLipnin commented Aug 24, 2018

Steps to Reproduce

  1. Compile and run the following code:
using System;
using System.Reflection;

class MainClass
{
    public static void Main(string[] args)
    {
        Type t = typeof(Derived);
        EventInfo e = t.GetEvent(nameof(Base.MyEvent));
        MethodInfo adder = e.AddMethod;
        MethodInfo remover = e.RemoveMethod;
        if (!t.Equals(adder.ReflectedType) || !t.Equals(remover.ReflectedType))
        {
            throw new Exception("not the same");
        }

        Console.Write("Press enter...");
        Console.ReadLine();
    }

    private class Base
    {
        public event Action MyEvent { add { } remove { } }
    }

    private class Derived : Base
    {
    }
}

or adapt this xunit test.
2.
3.

Current Behavior

The type of Derived class (MainClass+Derived) and ReflectedType of the event accessors (MainClass+Base) don't equal.

Expected Behavior

The type of Derived class and ReflectedType of the event accessors should equal (MainClass+Derived).

On which platforms did you notice this

[X] macOS
[ ] Linux
[X] Windows

Version Used:

$ mono -V
Mono JIT compiler version 5.14.0 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)
jaykrell added a commit to jaykrell/mono that referenced this issue Oct 5, 2018
This reverts commit 577ab74.

To try to fix:

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64/19377/parsed_console/log.html

     Mono issue mono#10276
    System.IO.Tests.MemoryStream_ConstructorTests.MemoryStream_Ctor_InvalidCapacities [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.OutOfMemoryException)
      Actual:   (No exception was thrown)
      Stack Trace:
          at System.IO.Tests.MemoryStream_ConstructorTests.MemoryStream_Ctor_InvalidCapacities () [0x0004a] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/external/corefx/src/System.IO/tests/MemoryStream/MemoryStream.ConstructorTests.cs:38
          at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
          at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:324
  Finished:    net_4_x_corlib_xunit-test
=== TEST EXECUTION SUMMARY ===
   net_4_x_corlib_xunit-test  Total: 91255, Errors: 0, Failed: 1, Skipped: 35, Time: 74.005s
make[2]: *** [run-xunit-test-lib] Error 1
../../build/tests.make:326: recipe for target 'run-xunit-test-lib' failed
make[2]: Leaving directory '/mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib'
../../build/rules.make:216: recipe for target 'do-run-xunit-test' failed
make[1]: *** [do-run-xunit-test] Error 2
make[1]: Leaving directory '/mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib'
/mnt/jenkins/workspace/test-mono-pull-request-amd64/scripts/ci/babysitter: Test suite terminated with code 2, will extract test results from XML. Halting.
*** end(93): corlib-xunit: Unstable
*** start: verify

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64/19393/parsed_console/log.html

Unit.net Console Runner v2.4.0 (64-bit Desktop .NET 4.7.2, runtime: 4.0.30319.42000)
  Discovering: net_4_x_corlib_xunit-test
  Discovered:  net_4_x_corlib_xunit-test
  Starting:    net_4_x_corlib_xunit-test
    System.Reflection.Tests.MemberInfoTests.TestInheritedEventAccessors [SKIP]
      Mono issue mono#10277
    System.Reflection.Tests.MemberInfoTests.TestGenericMethodsInheritTheReflectedTypeOfTheirTemplate [SKIP]
      Mono issue mono#10276
    System.IO.Tests.MemoryStream_ConstructorTests.MemoryStream_Ctor_InvalidCapacities [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.OutOfMemoryException)
      Actual:   (No exception was thrown)
      Stack Trace:
          at System.IO.Tests.MemoryStream_ConstructorTests.MemoryStream_Ctor_InvalidCapacities () [0x0004a] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/external/corefx/src/System.IO/tests/MemoryStream/MemoryStream.ConstructorTests.cs:38
marek-safar added a commit that referenced this issue Mar 12, 2019
Fixes #13350
Fixes #10277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.