Bug 41466

Summary: mono_class_is_subclass_of return incorrect value by assuming mono_class_init has been called on parameters
Product: [Mono] Runtime Reporter: Jonathan Chambers <joncham>
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono, mono-bugs+runtime, vargaz
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Test project

Description Jonathan Chambers 2016-06-02 17:45:12 UTC
Created attachment 16176 [details]
Test project

In an embedding scenario, I am calling mono_class_is_subclass_of on a class and an interface. In this case the class does actually implement the interface so I would expect TRUE to be returned. However, if the class has not been initialized the call returns FALSE since the interface check fails.

My assumption is that mono_class_is_subclass_of (and all embedding APIs) would call mono_class_init as needed. If this is not the case, I can work around it but it probably needs documented.

To reproduce:
unzip the attachment on OSX.
Edit build.sh to a local mono install
./build.sh
./a.out Main.exe

The final line of the output will read: mono_class_if_subclass_of: 0
Edit main.c to call mono_class_init on the klass
The final line of the output will read: mono_class_if_subclass_of: 1
Comment 1 Zoltan Varga 2016-06-07 08:14:56 UTC
Fixed in mono master 97634ecfae6b2b7ec4b1efd0e1a1fdcd23e69224.