Repository navigation
Closed
Description
Steps to Reproduce
- Open https://github.com/moginheden/brotherPrint
- Clean solution
- Build solution
Expected Behavior
Project should compile
Actual Behavior
Error list shows:
Severity Code Description Project File Line Suppression State
Error Unexpected error - Please file a bug report at http://bugzilla.xamarin.com PrintTest.iOS C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 794
Environment
Visual studio
Microsoft Visual Studio Enterprise 2017
Version 15.8.7
VisualStudio.15.Release/15.8.7+28010.2046
Microsoft .NET Framework
Version 4.7.02558
Installed Version: Enterprise
Application Insights Tools for Visual Studio Package 8.13.10627.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.8.05085.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2017 5.2.60618.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.8.05023.0
Azure App Service Tools v3.0.0
C# Tools 2.9.0-beta8-63208-01
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
JavaScript Language Service 2.0
JavaScript Language Service
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 1.0
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Mono Debugging for Visual Studio 4.11.11-pre (8fb558f)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.61808.07020
Microsoft SQL Server Data Tools
TypeScript Tools 15.8.20822.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.9.0-beta8-63208-01
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 55a3dc3231c95c77f81ee53f7d29152029da7408.
Microsoft Visual F# Tools 10.2 for F# 4.5
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.11.0.776 (d15-8@1ae9b59d7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 4.15.9 (d000f568b)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 1.1.116 (9619170)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 9.0.0.19 (HEAD/a8a3b0ec7)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 12.0.0.15 (84552a4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Build Logs
Was too long to fit in issue, see buildLog.txt in github project
Activity
moginheden commentedon Oct 22, 2018
I've also included my C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets file in the github repository since it was referenced in the error but I've never manually changed this file.
spouliot commentedon Oct 22, 2018
The error is in your build logs (or your repo)
spouliot commentedon Oct 22, 2018
This looks like a problem related to how you committed a file to github
https://github.com/moginheden/brotherPrint/blob/master/BrotherPrinterIOS/Native%20References/BRPtouchPrinterKitW.framework/BRPtouchPrinterKitW
should be a symlink to the real framework. Instead it's a text file, so the header does not match the magic number of a framework.
0x73726556 == sreVwhich are the first four characters of the file (Vers)If you fix your git repo to have a real symlink then it should work properly.
I'll keep this open since a better error than the (last resort fallback)
MT0000error code should be reported in such case.moginheden commentedon Oct 22, 2018
When I unzipped the framework, (on a Windows computer trying both Windows' built in unzip utility and 7-zip) it broke these links, (unzipping it on a Mac the links work, but once I copy it to a Windows computer they are broken again.)
I tried making Windows-style links and it couldn't read them.
I've now copied the linked files to where they were being linked and Visual Studio allows me to add the reference, but I'm getting the following warning and the object browser shows the project has nothing in it after building it.
Severity Code Description Project File Line Suppression State
Warning The referenced component 'Native References/BRPtouchPrinterKitW.framework' could not be found. BrotherPrinterIOS
The original zip file is from here: https://support.brother.com/g/b/agreement.aspx?dlid=dlfp100621_000&c=us_ot&lang=en&redirect=on how am I supposed to include this in my project?
(I've updated the github project with these settings.)
rolfbjarne commentedon Oct 23, 2018
@moginheden the simplest approach is to replace the symlink with the file it's pointing to.
Another solution is to create a binding project (on the mac) for the framework, and then copy the resulting assembly to your windows machine and reference it in your main project.
spouliot commentedon Oct 23, 2018
@moginheden you still have two (differently named) versions of the incorrect framework under your main application (you only fixed the binding project in your git repo) so you'll run into issues.
https://github.com/moginheden/brotherPrint/tree/master/PrintTest/PrintTest.iOS/Native%20References/BRPtouchPrinterKitW.framework
[mtouch] Display a specific error is a .framework binary is invalid. F…
moginheden commentedon Oct 23, 2018
I had already done this, but the error messages seem to persist after they have been fixed. I need to follow the following steps before it actually clears out the error from the log and re-compiles it, (if I miss any of these seemingly extra steps then the old version is used by visual studio. I'm guessing it's something to do with the mac it's linked to caching the files?)
1.) Remove the native reference from the project
2.) Delete the native reference from the underlying file system in my project folder
3.) Run the clean command on the project
4.) Restart visual studio
5.) Re-build the binding project (that claims no errors even though it has no native reference at the moment)
6.) Re-build the project that uses the binding project (get an error that the ApiDefinition.cs file is referencing something that doesn't exist, as it should at this point)
7.) Re-add the native reference to the binding project
8.) Rebuild both the binding project and the project that uses it.
I've now updated the github project again with 2 attempts to get this binding library to work:
1.) The BrotherPrinterIOS project uses the native reference method. It compiles with no errors on it's own, but if the PrintTest.iOS project references it I get a ton of std library references being missing such as this one:
Native linking error: "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::append(char const*)", referenced from: PrintTest.iOS C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 794
2.) The BrotherPrinterIOS2 project has a renamed BRPtouchPrinter file, (added .a extention and added it to the base of the project to make a linkwith.cs file.) This one shows no errors, but doesn't make the BRPtouchPrintKitW namespace available to the PrintTest.iOS project when I make it use BrotherPrinterIOS2.
Using the .linkwith.cs method I can see where I'd add a reference to include the std library, (and I think I've done so.) I don't know where to add it for the native reference method, (and ideally this would be auto-detected and included, but I'm not sure that is possible.)
I still see a couple of bugs here:
1.) Cleaning the project should clean the linked Mac's version of them too and reset all the compiler warnings.
2.) Compiler warnings/errors should show up when the bindings project is built, currently it seems to wait till they are referenced in another project.
3.) The error messages for missing std library methods references Xamarin.iOS.Common.targets. It should reference a file where these references can be fixed
4.) Whatever I'm missing in the BrotherPrinterIOS2 project should produce an error message instead of building then silently not including the BRPtouchPrintKitW namespace and BRPtouchPrinter interface in it's output.
spouliot commentedon Oct 24, 2018
It's likely mentioned in the Brother SDK (as an extra step for ObjC developers) as those are C++ symbols and there's nothing in your project that tells the (native) linker that C++ is required - so you end up with those failures. You must satisfy all requirements (e.g. required frameworks) from a 3rd party library you add to your project (just like an Xcode project has to do).
In this case if you add
-cxxin your project (e.g. in the Additional touch arguments of your project options) then the right flags (to use the C++ toolchain) will be given to the native linker and it will build correctly.When you use native references in your main project you need to update that (main) project with any additional requirement from that native (library) reference. There's no other place to store the information (as the native reference is left untouched). That's different if you use a binding project (where extra configuration can be set into that project).
moginheden commentedon Oct 24, 2018
I'm using a binding project. "BrotherPrintIOS" and a project that uses the binding project "PrintTest.iOS" The error message I'm getting should point me to the additional mtouch arguments field in the appropriate project.
moginheden commentedon Oct 24, 2018
Also now that I've added -cxx -framework CoreBluetooth to the PrintTest.iOS project, it is acting like it did using the BrotherPrintIOS2 project, (no errors when compiling the binding project, the only errors on the PrintTest.iOS project are that it can't find the BRPtouchPrintKitW namespace or the BRPtouchPrinter interface inside it.)
When I use the object browser the BrotherPrinterIOS project does not export anything.
moginheden commentedon Oct 24, 2018
Ok the problem seems to be I need to include a reference in the PrintTest.iOS project to both the "BrotherPrinterIOS" project AND the NativeLibrary.dll file it creates in the PrintTest.iOS bin directory. This seems odd to me.
Squashed commit of the following:
Squashed commit of the following:
Squashed commit of the following: