Bug 35680 - Binding issue: "the native class hasn't been loaded"
Summary: Binding issue: "the native class hasn't been loaded"
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.TVOS.dll ()
Version: XI 9.3 (xcode 7.1 previews)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: (C7)
Assignee: Bugzilla
Depends on:
Reported: 2015-11-09 07:43 UTC by Adam Hartley [MSFT]
Modified: 2016-01-11 17:47 UTC (History)
6 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 Adam Hartley [MSFT] 2015-11-09 07:43:19 UTC
After binding, when creating a new "DownloadableAgent", the following error occurs:

Could not create an native instance of the type 'DLAgent.DownloadableAgent': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

Setting "ObjCRuntime.Class.ThrowOnInitFailure" to false prevent the error from occurring, but calling the methods does not work.

The libraries are built for both arm64 and x86_64

Stack Trace:

at Foundation.NSObject.InitializeObject (Boolean alloced) [0x0003a] in /Users/builder/data/lanes/2128/efb0d4d9/source/maccore/src/Foundation/NSObject2.cs:170
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/data/lanes/2128/efb0d4d9/source/maccore/src/Foundation/NSObject2.cs:114
at DLAgent.DownloadableAgent..ctor (Foundation.NSUrl contentURL, DAContentType contentType) [0x00000] in /Users/admin/sky-mobile-app-ios-skygonline/DLAgent/obj/Debug/tvos/DLAgent/DownloadableAgent.g.cs:70
at Storm.iOS.App.Player.DrmPlayer.DrmClientImpl+<GetDrmContent>c__async2+<GetDrmContent>c__AnonStorey4.<>m__0 () [0x00020] in /Users/admin/sky-mobile-app-ios-skygonline/Storm.tvOS/App/Player/DrmPlayer/DrmClientImpl.cs:164
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-09 13:54:04 UTC
Note that as mentioned in the release notes [1] and the forum release announcement [2]:

> This version does not provide support for tvOS or watchOS in this release.
> Xamarin has previews (XI 9.3) available for both platforms. See our forums for
> the latest information and download links.

[1] http://developer.xamarin.com/releases/ios/xamarin.ios_9/xamarin.ios_9.1/

[2] http://forums.xamarin.com/discussion/54828/stable-release-xamarin-ios-9-1-0-ios-9-1-upstream-release/p1

I will mark this bug as NEEDINFO for now to check whether the problem still occurs for the customer on the Xamarin.iOS 9.3 preview version. If so, we can update the "Version" and "Target Milestone" fields accordingly.

Comment 4 kerstin.holzner 2015-11-10 02:48:14 UTC
We are working with the preview #2 builds:


On a Mac with El Capitan and XCode 7.2 Beta 2.
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-10 10:11:30 UTC
Thanks for the version info! I am updating the version and target milestone accordingly.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2015-11-23 12:51:58 UTC
It looks like the native library is correctly linked into the executable (which is the most common reason to get the "Could not create an native instance of the type ..." error), and I can't see anything else obviously wrong from the build logs.

Would it be possible to get a complete test solution we can use to reproduce this?
Comment 7 Sebastien Pouliot 2016-01-11 17:47:07 UTC
Please re-open, along with a test case, if this issue still exists in preview 4.