Bug 15346 - System Exception thrown Could not create an native instance of the type 'BrotherPiOS.BrotherPrinterTouchNetwork': the native class hasn't been loaded.
Summary: System Exception thrown Could not create an native instance of the type 'Brot...
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-10-10 18:26 UTC by Jon Goldberger [MSFT]
Modified: 2013-10-10 19:22 UTC (History)
2 users (show)

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

Test project that demonstrates the issue referencing generated .dll (40.18 KB, application/zip)
2013-10-10 18:26 UTC, Jon Goldberger [MSFT]
Objective Sharpie output (11.26 KB, text/plain)
2013-10-10 18:27 UTC, Jon Goldberger [MSFT]
Brother Printer Framework (528.23 KB, application/zip)
2013-10-10 18:28 UTC, Jon Goldberger [MSFT]
XCode static library project (23.02 KB, application/zip)
2013-10-10 18:29 UTC, Jon Goldberger [MSFT]
XS binding project (67.18 KB, application/zip)
2013-10-10 18:30 UTC, Jon Goldberger [MSFT]

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 Jon Goldberger [MSFT] 2013-10-10 18:26:53 UTC
Created attachment 5121 [details]
Test project that demonstrates the issue referencing generated .dll

We are wanting to add support for the Brother printer in both our iOS and
Android apps. A new developer has been assigned to the project and tried
to use Objective Sharpie but wasn't successful. He has followed the steps
outlined on the Xamarin iOS Binding
However, he is running into some problems.

Is there any insight you can provide? In his message (below) you can see
the error that he is ultimately getting after adding the manual bindings to
the DLL we are creating. Attached are all the relevant files such as the
ObjectiveSharpie output, the generated DLL which we wish to use in our
apps, and the original framework for the Brother Printer.

Original message:
Below is a list of steps I've taken towards establishing a Xamarin binding
for the iOS Brother Printer SDK. When the .dll product is included in the
project, it produces errors at run time which is referenced below.

Process Steps:

+ Generated fat file from the .framework file attached
- Architectures: i386, Armv7
+ Created iOS bindings project in Xamarin with the .a fat file.
+ Objective Sharpie attempts to generate bindings:
- Settings: SDK target = iOS 6.1
- Exited with error code: 1
- Output pasted in attached ("ObjectiveSharpieOutput.txt")
+ Manually generated bindings
- Binding project attached (BrotherPiOS.zip)
+ Included generated .dll in project solution
- System exception is thrown during class instantiation
- "Could not create a native instance of the type
'BrotherPiOS.BrotherPrinterTouchNetwork': the native class hasn't been
Comment 1 Jon Goldberger [MSFT] 2013-10-10 18:27:24 UTC
Created attachment 5122 [details]
Objective Sharpie output
Comment 2 Jon Goldberger [MSFT] 2013-10-10 18:28:22 UTC
Created attachment 5123 [details]
Brother Printer Framework
Comment 3 Jon Goldberger [MSFT] 2013-10-10 18:29:36 UTC
Created attachment 5124 [details]
XCode static library project
Comment 4 Jon Goldberger [MSFT] 2013-10-10 18:30:03 UTC
Created attachment 5125 [details]
XS binding project
Comment 6 Rolf Bjarne Kvinge [MSFT] 2013-10-10 19:22:02 UTC
> + Generated fat file from the .framework file attached

Don't do this, just use the BRPtouchPrinterKit.framework/Versions/A/BRPtouchPrinterKit directly as if it was a .a file.