Error since migrating to Unified version in Xamarin.IOS - xamarin.ios

I'm failing trying to migrate my Xamarin.IOS to use the new unified API using the automatic Xamarin Studio tools.
The solution is composed of 2 project. One PCL project and one Xamarin.IOS project that reference the PCL. When I try to build the project the following error appears:
.../FoodTruckiOS/MenuViewController.cs(10,10):
Error CS0012: The type `System.Object' is defined in an assembly that is not referenced.
Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' (CS0012) (FoodTruckiOS)
The line that throws the error in a ViewController has:
public MenuOption menuOption { get; set;}
MenuOption is a class a created in the PCL.
My version stack is:
=== Xamarin Studio ===
Version 5.7 (build 661)
Installation UUID: 242e1f09-6bb4-4b18-9d6c-3f8ec2ebc716
Runtime:
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
=== Apple Developer Tools ===
Xcode 6.1.1 (6611)
Build 6A2008a
=== Xamarin.Mac ===
Not Installed
=== Xamarin.iOS ===
Version: 8.2.0.207 (Indie Edition)
Hash: 3bf072d
Branch:
Build date: 2014-10-15 21:44:26-0400
=== Xamarin.Android ===
Not Installed
=== Build Information ===
Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7
=== Operating System ===
Mac OS X 10.10.1
Darwin Franciscos-Mini.lan 14.0.0 Darwin Kernel Version 14.0.0
Fri Sep 19 00:26:44 PDT 2014
root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Any idea what is causing the problem?

That should not happen but the software versions you're using a not a common match.
IOW you should be using Xamarin.iOS 8.6, which has the final, supported version of the unified API. The version above (Version: 8.2.0.207) has a preview of the unified API (and most recent binaries/components won't be compatible with it).
The same applies to Xamarin Studio 5.7 update tool. It was made to work with XI 8.6 (not the older versions) and that might give you close, but not perfect, match when updating a project/solution.

Related

This requires non-nullable language feature to be enabled — Dart non-nullable syntax error

I've activated Dart non-nullable syntax experiment in my pubspec.yaml file:
name: tests
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.9.0-21.0.dev.flutter <3.0.0"
analyzer:
enable-experiment:
- non-nullable
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
So, now after running flutter pub get I'm trying to create a class using non-nullable syntax:
class Component_Decorator_A extends Component_Decorator {
Component_Decorator_A([Component? component]) : super(component);
#override
operation() {
component?.operation();
print('Component_Decorator_A.Operation()');
}
}
Quite surprisingly, syntax analyzer in Android Studio says:
This requires non-nullable language feature to be enabled. Try updating your pubspec.yaml to set the minimum SDK constraint to 2.9.9 or higher, and running pub get.
Ok, I cannot set the minimum SDK version to exactly 2.9.0 as suggested, as far as each time I try to set environment: sdk: ">=2.9.0 <3.0.0" in my pubspec.yaml, the subsequent flutter pub get leads to the next version solving error that I was unable to resolve:
flutter pub get
Running "flutter pub get" in master000...
The current Dart SDK version is 2.9.0-21.0.dev.flutter-2e05e6c94a.
Because patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0, version solving failed.
---- Log transcript ----
FINE: Pub 2.9.0-21.0.dev.flutter-2e05e6c94a
MSG : Resolving dependencies...
SLVR: fact: patterns_experiments_and_tests is 1.0.0+1
SLVR: derived: patterns_experiments_and_tests
SLVR: fact: patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0
SLVR: conflict: patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0
SLVR: Version solving took 0:00:00.060030 seconds.
| Tried 1 solutions.
FINE: Resolving dependencies finished (0.1s).
ERR : The current Dart SDK version is 2.9.0-21.0.dev.flutter-2e05e6c94a.
|
| Because patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0, version solving failed.
FINE: Exception type: SolveFailure
FINE: package:pub/src/solver/version_solver.dart 312:5 VersionSolver._resolveConflict
| package:pub/src/solver/version_solver.dart 133:27 VersionSolver._propagate
| package:pub/src/solver/version_solver.dart 97:11 VersionSolver.solve.<fn>
| ===== asynchronous gap ===========================
| dart:async Future.catchError
| package:pub/src/utils.dart 113:52 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 126:11 captureErrors
| package:pub/src/command_runner.dart 193:13 PubCommandRunner.runCommand
---- End log transcript ----
pub get failed (1; ---- End log transcript ----)
Process finished with exit code 1
It should be noted here that flutter doctor -v reports that everything is pretty 'OK' in the project:
[✓] Flutter (Channel master, 1.21.0-5.0.pre, on Mac OS X 10.15.5 19F101, locale ru-RU)
• Flutter version 1.21.0-5.0.pre at /Applications/flutter
• Framework revision 2a063fc6c0 (11 дней назад), 2020-07-17 12:51:01 -0400
• Engine revision 1493883bf0
• Dart version 2.9.0 (build 2.9.0-21.0.dev 2e05e6c94a)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at /Users/sergeglushenko/Library/Android/sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.8.4
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.5 19F101
Would you please suggest me what should be done to make Dart non-nullable syntax steadily usable in Android Studio (latest version)?
I think this issue was being resolved with the new version. The migration guide for null safety is out now a mentioned in this comment:
Please read https://dart.dev/null-safety/migration-guide. You can't
just turn on null safety. We have docs and migration tooling available
for you!
And if it still doesn't work, try the suggestion here:
You should increase your current sdk version from sdk: ">=2.7.0
<3.0.0" to sdk: ">=2.12.0 <3.0.0" and run flutter pub get. If you
don't want to do that manually, you should run dart migrate --apply-changes in terminal. I recommend the second one

.NET Standard 2.0 Xamarin.iOS project VSTS build issue

Currently I'm trying to upgrade a Xamarin.Forms project to use .NET Standard 2.0. This went fine for Android but I'm getting stuck with the iOS version. To build iOS we use a On-Primise MacMini as build agent int VSTS. Now I'm getting the error below when building the solution.
=================================
.... way more erros like below ...
2017-11-21T11:39:43.8920830Z ViewModels/DashboardViewModel.cs(66,35): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9014700Z ViewModels/DashboardViewModel.cs(66,73): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9036150Z ViewModels/DashboardViewModel.cs(66,93): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9053280Z
2017-11-21T11:39:43.9083060Z 6 Warning(s)
2017-11-21T11:39:43.9107960Z 47 Error(s)
2017-11-21T11:39:43.9116100Z
2017-11-21T11:39:43.9131830Z Time Elapsed 00:00:59.23
2017-11-21T11:39:43.9327960Z ##[error]Xamarin.iOS task failed with error Error: /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild failed with return code: 1. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847.
2017-11-21T11:39:43.9575950Z [command]/usr/bin/security delete-keychain /Users/Admin/BuildAgent/_work/3/s/_xamariniostasktmp.keychain
2017-11-21T11:39:44.2658340Z ##[section]Finishing: Build Xamarin.iOS solution xxx.sln
=================================
This output comes from the following build definition:
Now I've searched the internet and found a view possible solutions:
Update Visual Studio on the MacMini
Update XCode on the MacMini
Install .NET Core 2.x SDK on the MacMini
Add .NET Standard 2.x NuGet package to Xamarin.IOS project
Add .NET Standard Library NuGet pre-release package to Xamarin.iOS project (not possible)
Manually reference netstandard.dll to the Xamarin.iOS project
Remove install argument (not using it)
But all of this was not enough to fix the issue. Now I'm not a expert in using a Mac. Actually I never touched one before this issue... So I might have done something wrong here...
But I've been able to get some version information about all products on the MacMini:
========= Visual Studio =========
Visual Studio Community 2017 for Mac
Version 7.2.2 (build 11)
Installation UUID: b43353ef-651c-468b-8b7d-3f1714586419
Runtime:
Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010006
NuGet
Version: 4.3.1.4445
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.3
SDK: /usr/local/share/dotnet/sdk/2.0.3/Sdks
SDK Version: 2.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
Xamarin.Profiler
Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Xamarin.Android
Not Installed
Xamarin Inspector
Not Installed
Apple Developer Tools
Xcode 9.1 (13532)
Build 9B55
Xamarin.iOS
Version: 11.3.0.47 (Visual Studio Community)
Hash: 51128b8c
Branch: xcode9.1
Build date: 2017-10-31 22:42:13-0400
Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
Build Information
Release ID: 702020011
Git revision: b604c37c5a4a2f0919b45ffbe2aaad9fe040af31
Build date: 2017-11-01 08:31:43-04
Xamarin addins: d57dc14cbd4eb166ee62bab585965ab78d3650bc
Build lane: monodevelop-lion-d15-4
Operating System
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Wed Oct 4 00:17:00 PDT 2017
root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64
============= XCode =============
XCode for Mac
Version 9.1 (9B55)
============= Mono ==============
Mono JIT compiler version 5.4.1.6 (2017-06/1f4613aa1ac Wed Oct 18 09:31:57 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-master/8b1520c8aae)
GC: sgen (concurrent by default)
========= .NET Core SDK =========
.NET Core SDK
Version 2.0.3
=================================
The project can be build on the MacMini itself. Only the VSTS task keeps failing...
Does someone have any idea's left which can help me solve my issue?
Kind regards,
Jop
Everything started to work fine after we manually edited the .NET Standard 2.0 project file (*.csproj) and add a PackageReference by hand.
<ItemGroup>
...
<PackageReference Include="NETStandard.Library" version="2.0.0" />
...
</ItemGroup>

How can I compile .Net Micro Framework Porting Kit solutions?

I have bought a ARM7S processor and I wanted to deploy the NETMF there. So I installed the .NETMF porting kit and a CodeSourcery GCC 4.6.3 compiler and tried to compile the solution for my processor.
I should say I have Windows 8.1 Enterprise x64, Visual Studio 2013 Ultimate installed on my PC.
At first I set debugger using this command: "setenv.cmd 4.6.3 C:\gcc" where I had installed my CodeSourcery ARM-EABI gcc compiler.
After that I had moved to folder "Solutions/--my CPU --/TinyCLR" and ran this command: "MSBUILD.EXE /t:build /p:flavor=release;memory=flash"
It took some time and throw a huge amount of errors. I downloaded a older version of the compiler and only one error left.
So I opened a clear version of Windows 7 x86 (virtually) and installed Visual Studio 2012 Professional. After that I tried the same but the error was the same.
"c:\MicroFrameworkPK_v4_3\Solutions\SAM7S_EK\TinyCLR\TinyCLR.proj" (build targe
t) (1) ->
(BuildAXF target) ->
c:\MicroFrameworkPK_v4_3\tools\targets\Microsoft.SPOT.System.GCC.targets(325,
5): error MSB3073: The command ""C:\gcc\bin\..\arm-none-eabi\bin\ld.exe" -stat
ic --gc-sections --no-warn-mismatch --library-path=c:\MicroFrameworkPK_v4_3\Bui
ldOutput\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\lib --library-path=c:\MicroFram
eworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib --allow-multip
le-definition -u ARM_Vectors -u _start --Map c:\MicroFrameworkPK_v4_3\BuildOutp
ut\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\bin\tinyclr.map --output=c:\MicroFram
eworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\bin\tinyclr.axf
--script=c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\FLASH\release\SA
M7S_EK\bin\tinyclr_scatterfile.ldf c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\G
CC4.2\le\FLASH\release\SAM7S_EK\obj\Solutions\SAM7S_EK\TinyCLR\tinyclr_dat.obj
c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\obj
\Solutions\SAM7S_EK\TinyCLR\allocator.obj c:\MicroFrameworkPK_v4_3\BuildOutput\
THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\obj\Solutions\SAM7S_EK\TinyCLR\tinyclr.o
bj -( c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\li
b\Core.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\relea
se\lib\Hardware.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_ME
DIA\release\lib\InterruptHandler.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB
\GCC4.2\le\ANY_MEDIA\release\lib\HeapPersistence_stub.lib c:\MicroFrameworkPK_v
4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\I2C_stub.lib c:\MicroFram
eworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\IOPort.lib c:\Mi
croFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\RPC_stub.
lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\
Serialization_stub.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY
_MEDIA\release\lib\Debugger.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4
.2\le\ANY_MEDIA\release\lib\Debugger_full.lib c:\MicroFrameworkPK_v4_3\BuildOut
put\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\Diagnostics_stub.lib c:\MicroFramewor
kPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\Graphics_stub.lib c:
\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\CorLib
.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib
\SPOT.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\releas
e\lib\SPOT_Messaging_stub.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2
\le\ANY_MEDIA\release\lib\SPOT_Serialization_stub.lib c:\MicroFrameworkPK_v4_3\
BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\SPOT_Hardware.lib c:\MicroFra
meworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\Messaging.lib c
:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\release\lib\CLRSt
artup.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\releas
e\lib\CRC.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\ANY_MEDIA\re
lease\lib\WireProtocol.lib c:\MicroFrameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le
\ANY_MEDIA\release\lib\SPOT_Hardware_SerialPort.lib c:\MicroFrameworkPK_v4_3\Bu
ildOutput\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\lib\tmp_tinyclr.lib c:\MicroFr
ameworkPK_v4_3\BuildOutput\THUMB\GCC4.2\le\FLASH\release\SAM7S_EK\lib\InteropAs
sembliesTable.lib -) -( "C:\gcc\arm-none-eabi\lib\thumb\libm.a" "C:\gcc\arm-non
e-eabi\lib\thumb\libc.a" "C:\gcc\lib\gcc\arm-none-eabi\4.2.1\thumb\libgcc.a" -)
-( c:\MicroFrameworkPK_v4_3\tools\ads_v3_1\Lib\armlib\h_t.l c:\MicroFrameworkP
K_v4_3\tools\ads_v3_1\Lib\armlib\c_t.l -)" exited with code 1. [c:\MicroFramewo
rkPK_v4_3\Solutions\SAM7S_EK\TinyCLR\TinyCLR.proj]
Does anybody knows how to fix it or if there is a place, where I can find compiler CLR?
Thanks,
Jonas

Monotouch - Failed to resolve ExtensionAttribute

Using Xcode 5.0.1 with Xamarin studio Version 4.0.13 (build 38) and Xamarin.iOS
Version: 6.2.4.2
I am getting this error when trying to compile my project:
error MT2002: Failed to resolve "System.Void System.Runtime.CompilerServices.ExtensionAttribute::.ctor()" reference from "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
How can I solve it?
The reason for this error is that between .NET 2.0 (including Silverlight) and 4.0 the [Extension] attribute moved from System.Core.dll to mscorlib.dll.
Xamarin.iOS 6.2 (and earlier) were based on a superset of Silverlight (aka the 2.1 profile). So the [Extension] attribute was located in System.Core.dll.
Since Xamarin.iOS 6.3+ the product was re-based on Mono 3.0 and the profile was updated to use the newer 4.0/4.5 profile. Now the [Extension] attribute is located in mscorlib.dll.
In your case you had a binary assembly compiled against the newer (4.0) profile. That assembly had a reference to mscorlib, Version=4.0.0.0, ... to find [Extension] and would lead to errors if built against the older Xamarin.iOS (6.2 and earlier).
As you found out the easy solution was to update to the latest Xamarin.iOS release. Another way to solve this (without updating Xamarin.iOS) would have been to rebuild (if you have the source) the binary assemblies of your project against the assemblies (BCL) shipped with Xamarin.iOS 6.2.

Undefined "___divmodsi4" linking Monotouch project with static library in release mode

I have a Monotouch project linked to a static library containing C++ modules.
Monotouch version: 3.0.3.5
XCode version: 4.4.1
C/C++ Compiler: Apple LLVM 4.0
When building the project in debug mode for iOS simulator and iOS device everything is OK -
application is linked and runs.
However when building the release configuration for iOS device the following error appears:
Undefined symbols for architecture armv7: "___divmodsi4"
The following line from the static library code somehow causes the trouble:
int number_of_buckets = num_samples / window_samples_step;
If this line is modified as follows the problem disappears:
int number_of_buckets = (int)((float)num_samples / (float)window_samples_step);
Do you have any ideas how to fix the problem without the above modification?
Thanks,
Ury.
This occurs near the end of the build and generally depends on it's original parameters. Try to compare your options between your Release and Debug builds and check that:
you are using the same Additional mtouch arguments on both configuration;
you are using the same compiler, Mono AOT versus LLVM compilers, on both configuration;
you are using the same architecture, ARMv6 versus ARMv7, on both configuration.
Otherwise attach (e.g. preferable to a bug report or pastebin) the full build log (from the Build Output of MonoDevelop's Error Pad) for both Debug and Release builds.
To be more helpful add "-v -v -v" to the Additional mtouch arguments before re-building. This will augment the verbosity (details) about each steps.
You need to set the app's Deployment Target (in the project's options, Build / iPhone Application page) to at least 5.0.

Resources