Bug 41466 - mono_class_is_subclass_of return incorrect value by assuming mono_class_init has been called on parameters
Summary: mono_class_is_subclass_of return incorrect value by assuming mono_class_init ...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-02 17:45 UTC by Jonathan Chambers
Modified: 2016-06-07 08:14 UTC (History)
3 users (show)

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


Attachments
Test project (1.25 KB, application/zip)
2016-06-02 17:45 UTC, Jonathan Chambers
Details

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.

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