This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 47867 - assert at sre.c:1553 in System.Reflection.Emit.TypeBuilder.create_runtime_class
Summary: assert at sre.c:1553 in System.Reflection.Emit.TypeBuilder.create_runtime_class
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection (show other bugs)
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2016-11-24 17:31 UTC by Robert van der Boon
Modified: 2016-12-01 15:38 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test file (1.10 KB, text/plain)
2016-11-24 17:31 UTC, Robert van der Boon
Details
Assert Abort Stacktrace (5.52 KB, text/plain)
2016-11-24 17:32 UTC, Robert van der Boon
Details
Standalone reproduction (846 bytes, text/plain)
2016-11-28 18:04 UTC, Aleksey Kliger
Details

Description Robert van der Boon 2016-11-24 17:31:37 UTC
Created attachment 18657 [details]
Test file

When using Rhino mocks to create a DynamicMock for an interface with a generic method an assertion is raised and the process dies.

See attached both a test case and the stacktrace.
compile the testcase with:
  mcs -t:exe -r:Rhino.Mocks test.cs
run with:
  mono --debug test.exe

If you compile with -DLESS_GENERIC the test succeeds (prints: "Done: 00000000-0000-0000-0000-000000000000")
Comment 1 Robert van der Boon 2016-11-24 17:32:04 UTC
Created attachment 18658 [details]
Assert Abort Stacktrace
Comment 2 Aleksey Kliger 2016-11-28 17:36:36 UTC
This is one of our awesome corner cases where a finished typebuilder references a generic instantiation of an unfinished one.  reflection_setup_internal_class minimally initializes the referenced type, but it doesn't have enough info to make the call on whether the type will be a generic or not. But when we go to instantiate in mono_reflection_bind_generic_parameters we expect to see a generic type definition.

Working on a minimal standalone reproduction...
Comment 3 Aleksey Kliger 2016-11-28 18:04:48 UTC
Created attachment 18698 [details]
Standalone reproduction

Standalone reproduction without dependencies.
Comment 4 Aleksey Kliger 2016-12-01 15:38:18 UTC
Fixed in Mono master https://github.com/mono/mono/commit/a713a14521da8ddf992c4a3e64855d56cb7897a3

Note You need to log in before you can comment on or make changes to this bug.