Bug 56017 - Compilation error while using the OpenTK 2.0 library in a C# (Xamarin) Android project
Summary: Compilation error while using the OpenTK 2.0 library in a C# (Xamarin) Androi...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.0 (C8)
Hardware: Other Other
: Normal enhancement
Target Milestone: ---
Assignee: Radek Doulik
Depends on:
Reported: 2017-05-05 06:13 UTC by Dhiren Sarup
Modified: 2017-08-24 03:37 UTC (History)
2 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 Dhiren Sarup 2017-05-05 06:13:10 UTC
Steps to reproduce the bug:

1) Download the OpenTK 2.0-0 library from https://github.com/opentk/opentk/releases
2) Compile OpenTK 2.0 using Visual Studio 2015/17.
3) Add OpenTK as a reference (\src\OpenTK\bin\Release\Android\OpenTK.dll) to a C# Android project instead of the default OpenTK.dll (version available in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0
4) Derive a class from OpenTK.Platform.Android.AndroidGameView in the C# Android project, and try compilation. The following compilation error is reported:

obj\Debug\android\src\md55885a86221361af52222b5e7c9968a43\SampleGLView.java:5: error: package opentk_1_1.platform.android does not exist

Please also refer the link: https://github.com/opentk/opentk/issues/494

The compilation error may be solved by using the above mentioned link, but at runtime the application crashes as the OpenGL render context is not created on the actual Android Marshmallow 6.0 device used for testing. While debugging inside the OnLoad() method of the class derived from AndroidGameView, add 'this' to the Watch Window. The actual class members such as AndroidGameView.ContextRenderingApi that are present in OpenTK 2.0 are not visible, and instead the OpenTK class members such as AndroidGameView.GLContextVersion are instead visible in the Watch window. This means that the older registered version of OpenTK is being used by the Android application instead of OpenTK 2.0.

Hence, I request you to please add support for OpenTK 2.0 in C# Android projects.
Comment 1 Dhiren Sarup 2017-05-05 06:38:16 UTC
Additional reference link: https://bugzilla.xamarin.com/show_bug.cgi?id=18575
Comment 2 Radek Doulik 2017-06-29 10:24:54 UTC
Could you please attach sample project which replicates the problem? You might be mixing 2 OpenTK versions?
Comment 3 Radek Doulik 2017-06-29 10:31:38 UTC
BTW, the 0.9 version is really old. You might try the OpenTK-1.0 we ship with Xamarin.Android.
Comment 4 Cody Beyer (MSFT) 2017-08-23 21:22:53 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!
Comment 5 Dhiren Sarup 2017-08-24 03:37:24 UTC

   I used OpenTK 1.0 that is shipped with Xamarin.Android instead of using OpenTK 2.0. Thanks.