Bug 52169 - OpenTK namespace clashes
Summary: OpenTK namespace clashes
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 10.3 (iOS 10.2)
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-02-01 05:04 UTC by Tzach Shabtay
Modified: 2017-02-06 23:19 UTC (History)
4 users (show)

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

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 Tzach Shabtay 2017-02-01 05:04:50 UTC
Description of Problem:

Xamarin.IOS contains types with the OpenTK namespace (like OpenTK.Vector2, for example), which clashes when you're actually trying to use OpenTK in your project.
The only workaround seems to be using extern alias (which looks ugly, and also brings its own issues: https://bugzilla.xamarin.com/show_bug.cgi?id=52168).
Comment 1 Alex Soto [MSFT] 2017-02-02 07:39:35 UTC
Hello Tzach

Are you using your own build of OpenTK or the nuget package? If you are using your own build you could exclude those to avoid the clash. If you are using the nuget package then using the extern alias seems to be your best option.

Another option is that you can use the OpenTK dll we provide, if you double click on the references folder and click on packages you will see it, it is based on our fork (https://github.com/mono/opentk).

We do have those types borrowed from OpenTK because they are used by Xamarin.iOS dll and we did not want to bring the full OpenTK assembly (also not binding it to a specific version) in order to use them so we can't just remove them from the X.I assembly.
Comment 2 Tzach Shabtay 2017-02-03 04:06:03 UTC
"Are you using your own build of OpenTK or the nuget package? If you are using your own build you could exclude those to avoid the clash."

I'm building from source (just because the nuget currently doesn't support ios & android), but will switch to nuget once they add those in. I don't want to work with a modified source.

"Another option is that you can use the OpenTK dll we provide"

No, it's out-of-date, the recommendation is to use the official OpenTK.

"so we can't just remove them from the X.I assembly."

Well, not remove them, but how about changing the namespace?
Comment 3 Alex Soto [MSFT] 2017-02-03 19:54:03 UTC
Hello again Tzach, we currently do not have plans to make this change since it would be a very big breaking one. The ideal fix is to have the iOS build of the custom OpenTK to refer to Xamarin.iOS.dll instead of including it’s own also our fork https://github.com/mono/opentk is public so anyone can contribute :)