The MT2001 error is a general, something went bad, in the linker code
base. The stack trace is often enough to track down issues but in some
cases it would be easier to ask customers for a specific assembly
(rather than their complete project) to investigate an issue.
Example:
error MT2103: Binding Optimizer failed processing `System.Void GoogleConversionTracking.Unified.GoogleConversionPing::.ctor()`.
--- inner exception
System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00026] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:264
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, Int32 i) [0x00337] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:197
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.Process (Mono.Cecil.MethodDefinition method) [0x0007b] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:81
at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00004] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:48
---
at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00014] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:50
at Mono.Tuner.SubStepDispatcher.DispatchMethod (Mono.Cecil.MethodDefinition method) [0x0001d] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:215
at Mono.Tuner.SubStepDispatcher.BrowseMethods (ICollection methods) [0x0001c] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:167
at Mono.Tuner.SubStepDispatcher.BrowseTypes (ICollection types) [0x0006b] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:145
at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (IEnumerable`1 assemblies) [0x00050] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:123
at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:104
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker/Pipeline.cs:118
at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1& assemblies) [0x000ac] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Tuning.cs:79
Right now the MT2001 would only include the inner exception, which does
not include any clue to which assembly caused the exception.
Note: The same pattern to be applied to other BaseSubStep subclasses in
separate commits.
Related to (but not the fix for) https://bugzilla.xamarin.com/show_bug.cgi?id=44701
Some binding assemblies contains extra, unneeded code, generated by the C# compiler, e.g.
IL_002f: stloc.0
IL_0030: ldloc.0
which the binding optimizer did not expect.
https://bugzilla.xamarin.com/show_bug.cgi?id=44701
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.
So refactor the code to have one static list of tasks, which each subtask adds
to.
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.
So refactor the code to have one static list of tasks, which each subtask adds
to.
* Fix default http message handler for watchOS.
Fix default http message handler for watchOS to be NSUrlSessionHandler (the
previous attempt at eb7c2fd was quite incomplete), and make sure
HttpClientHandler is never used (show errors if someone tries).
* [tests] Remove explicit http client handler from project files.
Just use the default instead, since the set of valid http client handlers varies between platforms.
We've used the dynamic registrar for years now when selecting the IL registrar
(and I've never heard about anybody doing it), so just remove all the related
(and in fact dead) code.
This is something that changed with 70f1346b: our libxamarin.dylib now
requires iOS 8+, which means the app itself must require iOS 8+ when using
libxamarin.dylib.
This fixes an msbuild failure (Xamarin.iOS.Tasks.IBToolLinking("iPhone").BuildTest):
Process exited with code 1, command:
/Applications/Xcode73.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -framework Foundation -framework UIKit /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.dylib /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.dylib -lz -isysroot /Applications/Xcode73.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -Qunused-arguments -miphoneos-version-min=7.0 -arch armv7 -shared -read_only_relocs suppress -install_name @executable_path/libXamarin.iOS.dll.dylib -fapplication-extension -o /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/msbuild/tests/MyIBToolLinkTest/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.armv7.dylib -x assembler /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/msbuild/tests/MyIBToolLinkTest/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.armv7.s -DDEBUG
ld: warning: embedded dylibs/frameworks only run on iOS 8 or later
ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@executable_path/libxamarin-debug.dylib) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
We need to compile the generated P/Invoke wrappers to a dylib, and link the
dylib for the product assembly (Xamarin.WatchOS.dll) with the generated
P/Invoke wrappers.
Since there might be P/Invokes in any assembly, just link in the P/Invoke
wrapper dylib for every assembly.
https://bugzilla.xamarin.com/show_bug.cgi?id=44048
note: AVFoundation is commented on watchOS 3 as this breaks the static
registrar .a helper built for watchOS.
AVFoundation does a file check to enable some types - but the watchSimulator
include that file, leading to compilation errors later (missing CMTime.h)
#if TARGET_OS_WATCH
#if ! __has_include(<AVFoundation/AVAnimation.h>)
#define AVF_IS_WATCHOS_SDK 1
#endif
#endif
The real fix for bug #43658 is in mono master, but the current
version of mono master doesn't build for us, so implement this
workaround instead.
The problem is that the linker doesn't preserve fields of nested types marked
in xml descriptions unless the declaring type is marked. So the workaround
(until we can bump mono) is to mark the declaring type.
https://bugzilla.xamarin.com/show_bug.cgi?id=43658
* Bump [watch-]mono to master to get fix for #43658.
https://bugzilla.xamarin.com/show_bug.cgi?id=43658
* [mtouch/mmp] Fix build after breaking cecil update in mono.
Also use mono's cecil instead of our own cecil submodule for mtouch.
* Bump [watch-]mono to get compilation fixes after cecil bump in mono.
* Remove cecil submodule, we only use the one in mono now.
This way we use the right version of any dependent dlls.
Otherwise we'd build with the cecil version from the mono repository,
and run with the system's cecil.
* [Mtouch] Use the mono tools to copy over the msym files.
* As per review:
* Do not create a DirectoryInfo when it is not needed.
* Do not throw exceptions for values that can be null, should never
happen.
* Remove unused import.
* Undo a wrong using removal and do the right thing.
* Fix build issues.
* [C8] Bump to latest Mono 4.6.0 commit
Brings in the netstandard updates from https://github.com/mono/mono/pull/3394
We also had to add a new assembly System.IdentityModel.dll to the mobile profiles while doing that work.
* Add System.IdentityModel to Sdk assemblies
Fixes the following mtouch test failure:
```
Xamarin.Linker.SdkTest.iOS_Classic : BCL
Expected:
But was: < "System.IdentityModel" >
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x47bec88 + 0x00047> in :0
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x47bec58 + 0x0001f> in :0
at Xamarin.Linker.SdkTest.BCL (System.String path) <0x47bccf0 + 0x003f3> in :0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x47bcc50 + 0x0001b> in :0
```
Fixes the following mtouch test failure:
```
Xamarin.Linker.SdkTest.iOS_Classic : BCL
Expected:
But was: < "System.IdentityModel" >
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x47bec88 + 0x00047> in :0
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x47bec58 + 0x0001f> in :0
at Xamarin.Linker.SdkTest.BCL (System.String path) <0x47bccf0 + 0x003f3> in :0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x47bcc50 + 0x0001b> in :0
```
- Linking breaks extensions for as long as we have the "extensions must be use static registrar" hack.
- So let's ignore it with a warning. Better that random brokeness.
- https://bugzilla.xamarin.com/show_bug.cgi?id=43197
- Linking breaks extensions for as long as we have the "extensions must be use static registrar" hack.
- So let's ignore it with a warning. Better that random brokeness.
- https://bugzilla.xamarin.com/show_bug.cgi?id=43197
* Enable some SceneKit-related WatchKit API
* Enable some SceneKit-related SpriteKit API
* Enable some SceneKit-related Foundation API
* Fix generator to include `using SceneKit;` on watchOS
* Adjust xtro tests since watchOS headers include some stuff that's not available in reality
* Lots of [Watch (3,0)] attributes
This is only applicable to tvOS 10 (i.e. the xcode8 branch),
but applying the patch already helps avoiding merge failures
for other fixes in the same area.
* Bump mono and watch-mono
* [mmp] Preserve TransparentProxy::StoreRemoteField
This is needed to prevent a mono assert when xamarin-macios is built
with mono master after mono/mono@6b8e96c
We tried disabling dlsym for all assemblies on iOS, but it turned
out to break a significant amount of customer code [1].
So re-enable it, but only for user assemblies (since we control
all assemblies we ship and can thus make sure those work with
dlsym disabled).
https://trello.com/c/guig1MF2/623-re-enable-dlsym-for-ios
We tried disabling dlsym for all assemblies on iOS, but it turned
out to break a significant amount of customer code [1].
So re-enable it, but only for user assemblies (since we control
all assemblies we ship and can thus make sure those work with
dlsym disabled).
https://trello.com/c/guig1MF2/623-re-enable-dlsym-for-ios
Fixes the Sdk test:
Errors and Failures:
1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x30d2808 + 0x0004b> in <filename unknown>:0
2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.iOS_Unified () <0x30d5558 + 0x0004b> in <filename unknown>:0
3) Test Failure : Xamarin.Linker.SdkTest.tvOS
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.tvOS () <0x30d55d8 + 0x0004b> in <filename unknown>:0
4) Test Failure : Xamarin.Linker.SdkTest.watchOS
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.watchOS () <0x30d5658 + 0x0004b> in <filename unknown>:0
* [XM] Fix linker ability to deadstrip library loads from NSObject.mac.cd for new libraries
- Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=42177 in Release / Mobile since we can rip out GameController if not used
Fixes the Sdk test:
Errors and Failures:
1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x30d2808 + 0x0004b> in <filename unknown>:0
2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.iOS_Unified () <0x30d5558 + 0x0004b> in <filename unknown>:0
3) Test Failure : Xamarin.Linker.SdkTest.tvOS
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.tvOS () <0x30d55d8 + 0x0004b> in <filename unknown>:0
4) Test Failure : Xamarin.Linker.SdkTest.watchOS
System.Security.Cryptography.Algorithms
Expected: True
But was: False
at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
at Xamarin.Linker.SdkTest.watchOS () <0x30d5658 + 0x0004b> in <filename unknown>:0
Category methods are exposed like extension methods, and the first parameter
specifies the class, which means we need to skip the first type when generating
the ObjC signature.
https://bugzilla.xamarin.com/show_bug.cgi?id=42489
There can be circular dependencies between Objective-C classes,
so make sure we don't fail compilation when that occurs by
forward declaring any Objective-C classes/protocols.
The test case in question does not contain a circular dependency,
but the same issue occurs due to types not being generated in the
correct order (a correct order could be constructed for the test
case, but there's no general solution since circular dependencies
can exist).
https://bugzilla.xamarin.com/show_bug.cgi?id=42454
Category methods are exposed like extension methods, and the first parameter
specifies the class, which means we need to skip the first type when generating
the ObjC signature.
https://bugzilla.xamarin.com/show_bug.cgi?id=42489
There can be circular dependencies between Objective-C classes,
so make sure we don't fail compilation when that occurs by
forward declaring any Objective-C classes/protocols.
The test case in question does not contain a circular dependency,
but the same issue occurs due to types not being generated in the
correct order (a correct order could be constructed for the test
case, but there's no general solution since circular dependencies
can exist).
https://bugzilla.xamarin.com/show_bug.cgi?id=42454
Fixes NSCharacterSetTest.NSMutableCharacterSet_TestStaticSets when
running with the P/Invoke wrapper (for exceptions) enabled (i.e.
watchOS), since otherwise the wrapper would truncate char parameters
to byte.
* Added Speech Framework bindings
* Ensured introspection test pass
* Ensured we link against Speech framework
* FIXME: SFSpeechRecordingRecognitionRequest is not in the public api
filled radar://26799291 https://trello.com/c/s6s6YKua
* Added CallKit Bindings
* Ensure CallKit.framework is linked
* Ensure CallKit passes introspection tests
* FIXME: https://trello.com/c/afWXDZ3A
Headers says CallKit is available on macOS 10.12
but uses AVAudioSession and it is iOS only
Opened Radar awaiting response.
There's a clang bug [2] where if a selector is marked as unavailable,
it's marked as unavailable for every class, not just the class where
the unavailable selector is.
This means that we can't do `[super initWithCoder:x]` anywhere,
because `initWithCoder:` is marked as unavailable for UIActivityViewController.
So instead rewrite the call to super to call objc_msgSendSuper
directly, circumventing clang's broken availability checks.
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=41319
[2] https://llvm.org/bugs/show_bug.cgi?id=28058
[XM] Add release value option to msbuild/mmp to resolve XM 4.5 assemblies from system GAC
- This option "reverts" a C7 fix that prevented resovling assemblies from the GAC, which is unsafe
- If you use this option, you need to know what you are doing. The mono BCL and the XM BCL need to be compatible
- Use strictly puts you in the no support "you get to keep the pieces if it breaks" category.
This is because Mono doesn't build a libmono-profiler-log.dylib when
bitcode is enabled, so we can't support profiling + fastdev at the same
time.
Hopefully mono will fix this (see bug#41428) soon, in which case
this code can be removed.
https://bugzilla.xamarin.com/show_bug.cgi?id=41428
* [XM] Teach XM's mmp tool to handle read only assemblies/native libs
- https://bugzilla.xamarin.com/show_bug.cgi?id=41037
- mmp should also promote any install_name_tool errors to "real" errors
* Bump maccore
In cycle 7 we turned off, by default, the `dlsym` option (i.e. looking
up symbols for p/invoke) for tvOS and watchOS.
However we decided to wait for iOS to see if this caused issues for
existing code base. There has not been such reports (for tvOS) so,
for cycle 8, we'll turn it off (and use direct calls) for iOS.
If problems arise during the alpha/beta of C8 then we still can
revert this change easily.