Bug 56881 - Partial Static Registrar Changes DomNode GetType behavior
Summary: Partial Static Registrar Changes DomNode GetType behavior
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: mmp ()
Version: Master
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2017-05-26 16:07 UTC by Chris Hamons
Modified: 2017-05-31 14:19 UTC (History)
4 users (show)

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

Repro (349.94 KB, application/zip)
2017-05-26 16:07 UTC, Chris Hamons

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Chris Hamons 2017-05-26 16:07:01 UTC
Created attachment 22510 [details]

Reported from here: https://forums.xamarin.com/discussion/comment/276776#Comment_276776

- Expand sample and build/run
- Click button and note that 2nd text field gives type of: WebKit.DomNode
- Add --registrar:dynamic and repeat. Type is WebKit.DomHtmlDivElement (this is the expected behavior)
- Add static instead. Type is WebKit.DomHtmlDivElement (as expected).
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-05-31 13:09:36 UTC
This is fixed in master, but I can reproduce the failure in 15.2.

This happens because in 15.2, we don't link all the system frameworks into the executable at build time, they're loaded at a later point.

However the partial static registrar loads the Objective-C class at startup (before main), which means that it won't find the DOMHTMLDivElement class, and thinks it doesn't exist, so at a later point XM will instantiate the first known supertype (in this case DomNode).

In master we're linking with all the required frameworks, which means we'll find the DOMHTMLDivElement class at startup, and the problem doesn't occur.
Comment 2 Chris Hamons 2017-05-31 14:19:20 UTC
Great analysis Rolf (as always).

As a work around, adding these mmp link flags:

--link_flags="-framework Webkit"

appears to be an acceptable work around.