Граф коммитов

8886 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 48090369db
[xharness] Enable the .NET tests when a file containing 'dotnet' is modified. (#9510)
* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified.

This also required adding support for using regex as file names when selecting
which tests to run.

* Remove redundant dotnet prefix.

* [xharness] Rename variables to match usage.
2020-08-27 19:15:56 +02:00
Rolf Bjarne Kvinge e2f7c2f64f
[dotnet-linker] Add ApplyPreserveAttribute into the pipeline. (#9529)
This means:

* Move the parts of the ApplyPreserveAttribute step that we don't need for.NET
  into a new MobileApplyPreserveAttribute step, and have mtouch and mmp use
  that step instead of the ApplyPreserveAttribute step.

* Copy ApplyPreserveAttributeBase into dotnet-linker from the upstream tuner
  source (with minor modifications) so that our ApplyPreserveAttribute step
  compiles.

* Create a DotNetSubStepDispatcher class that we're going to use as our
  substep dispatcher, create an instance of it and insert it into the list of
  linker steps.

* Also a workaround for the lack of LinkContext.GetAssemblies (): add a step
  that collects all the assemblies and stores them in a list, so that we can
  have our own GetAssemblies implementation.

  I filed a linker issue to see if we can get LinkContext.GetAssemblies ()
  exposed to us: https://github.com/mono/linker/issues/1455.

Fixes this startup crash with the linkall test:

     2020-08-26 19:47:10.219697+0200 link all[32709:6065783] Xamarin.iOS: Fatal error: failed to load the method 'ObjCRuntime.Runtime.Initialize'.

    =================================================================
      Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
      Native stacktrace:
    =================================================================
      0x104007b0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
      0x103fb4437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
      0x104007365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
      0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
      0x0 - Unknown
      0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
      0x103daad98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_assertion_message
      0x103dade77 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_initialize
      0x103dbf80b - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_main
      0x103cd2f0d - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/link all : main
      0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start

This is a partial/modified port of the initial linker support (bc88790201)

Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
2020-08-27 18:30:19 +02:00
Rolf Bjarne Kvinge 3148d28b3e
[msbuild] Unify the code to define our platform-specific conditional compilation symbols. (#9524) 2020-08-27 17:47:31 +02:00
Rolf Bjarne Kvinge 62cd5311bc
[msbuild] Emit binding resources to the EmbeddedResource item group instead of ManifestResourceWithNoCulture. Fixes #3876. (#9525)
Fixes this warning:

    warning MSB9004: ManifestResourceWithNoCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Resx', and optional LogicalName.

There is a slight difference with regards to the warning message: the Type
metadata is set to 'Non-Resx' instead of 'Resx' (because these resources
aren't resx files).

Fixes https://github.com/xamarin/xamarin-macios/issues/3876.
2020-08-27 17:47:21 +02:00
Rolf Bjarne Kvinge 8ebb66eca0
[dotnet-linker] Print out substeps too when printing pipeline steps. (#9528) 2020-08-27 17:11:02 +02:00
Rolf Bjarne Kvinge e77a737c08
[xharness] Enable monotouch-test/.NET by default, but ignore all variations. (#9526)
* [xharness] Enable monotouch-test/.NET by default, but ignore all variations.

The default (Debug) configuration is green now, but the rest of the variations aren't yet.

* [tests] Ignore LocaleTest.InitRegionInfo in .NET because it needs globalization data.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

I can't reproduce locally, because it's ignored for me:

    [INCONCLUSIVE] InitRegionInfo : You can construct locale without countries
        at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in [...]/xamarin-macios/tests/monotouch-test/Foundation/LocaleTest.cs:line 47

but this should fix this monotouch-test test failure (I'm guessing that 'IV'
stands for 'Invariant', which is all the current .NET version ships with):

    MonoTouchFixtures.Foundation.LocaleTest
        [FAIL] InitRegionInfo :   Name
            String lengths are both 2. Strings differ at index 0.
            Expected: "US"
            But was:  "IV"
            -----------^
                 :    at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Foundation/LocaleTest.cs:line 49
2020-08-27 16:54:08 +02:00
Rolf Bjarne Kvinge d5ddc920e7
[tests] Skip the TypeDescriptorCanary test in .NET. (#9527)
It tests internal implementation details, and those details have now changed
(https://github.com/dotnet/runtime/pull/39973). So just skip the entire test
for now.

Fixes this test failure:

    DontLink.CommonDontLinkTest
        [FAIL] TypeDescriptorCanary : System.InvalidCastException : Specified cast is not valid. :    at DontLink.CommonDontLinkTest.TypeDescriptorCanary() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/linker/CommonDontLinkTest.cs:line 22
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-27 16:01:49 +02:00
Rolf Bjarne Kvinge 5a85c17e6d
[runtime] Give a better error message if we can't load ObjCRuntime.Runtime.Initialize () (#9514)
* [runtime] Give a better error message if we can't load ObjCRuntime.Runtime.Initialize ()

Otherwise we'll get a SIGSEGV due to dereferencing NULL.

* Rework strings a bit to have fewer unique strings.
2020-08-27 13:29:12 +02:00
Rolf Bjarne Kvinge a65ff94b4c
[xharness] Use the local 'ignore' variable instead of fetching 'test.TestProject.Ignore' for every test when generating test variations. (#9518) 2020-08-27 08:27:47 +02:00
Rolf Bjarne Kvinge 15ae4595b9
[dotnet] Add support for setting the exception marshalling mode in the GenerateMain step. (#9517)
* [dotnet] Pass exception marshaling options to the linker configuration, and pass it along to the Application instance.

* [dotnet] Write the selected exception marshaling modes to the generated main file.

* [dotnet-linker] Set the default cooperative GC mode.

The code to select the default exception marshalling mode needs it.
2020-08-27 08:27:31 +02:00
Rolf Bjarne Kvinge 3a0580750d
[msbuild] Share the _CollectGeneratedSources target between Xamarin.iOS and Xamarin.Mac. (#9516) 2020-08-27 08:08:03 +02:00
Rolf Bjarne Kvinge 30b1a8acbd
[tests] Port link all to .NET (#9515)
* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.
2020-08-27 08:07:50 +02:00
Rolf Bjarne Kvinge 1d8a39c830
Bump .NET to 5.0.100-rc.1.20414.5. (#9513) 2020-08-27 08:06:15 +02:00
Rolf Bjarne Kvinge 003dfa0db4
[linker] Fix typo in method name: MarkDefautConstructor -> MarkDefaultConstructor (#9512) 2020-08-27 08:05:28 +02:00
Rolf Bjarne Kvinge f613eacd9b
[msbuild] Parse --marshal-managed-exceptions and --marshal-objectivec-exceptions in ParseBundlerArgumentsTask. (#9493)
Also add some tests.
2020-08-26 19:03:45 +02:00
Rolf Bjarne Kvinge 020f8e2fab
[msbuild] Re-use existing logic to compress frameworks for the ObjCBindingNativeFramework items. (#9504) 2020-08-26 19:03:18 +02:00
Rolf Bjarne Kvinge 87395b4ef1
[tests] Port link sdk to .NET. (#9509)
And fix all the test failures, so that the Debug configuration is green.
2020-08-26 18:38:13 +02:00
Rolf Bjarne Kvinge 09e3631cb1 [xharness] link sdk is now green on .NET!
At least the Debug configuration is, there's still a test failure in the Release
configuration, so skip that for now.
2020-08-26 10:05:21 +02:00
Rolf Bjarne Kvinge 1adcd5e89c [tests] Adjust the PclTest.ServiceModel test to not throw ArgumentNullException in .NET.
This fix works just as well for the current Mono BCL as well, so there's no .NET condition.

This fixes this link sdk test:

    LinkSdk.PclTest
        [FAIL] ServiceModel : System.ArgumentNullException : Value cannot be null. (Parameter 'name')
            at System.ServiceModel.Channels.AddressHeaderCollection.FindAll(String name, String ns)
            at LinkSdk.PclTest.ServiceModel() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/PclTest.cs:line 73
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge eb79bccd74 [tests] Skip testing Environment.SpecialFolder.ProgramFiles in .NET due to a .NET issue.
Ref: https://github.com/dotnet/runtime/issues/41383

Fixes this link sdk test failure:

    [FAIL] SpecialFolder :   /Users/rolf/Library/Developer/CoreSimulator/Devices/0E45B8DF-05EF-47E7-A31F-3B829DEA2628/data/Containers/Data/Application/6454039E-D5F1-4C41-BF16-6C81CBAB1724/Applications
        Expected: True
        But was:  False
            at LinkSdk.LinkSdkRegressionTest.TestFolder(SpecialFolder folder, Boolean supported, Boolean exists, Boolean readOnly) in [...]/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 815
            at LinkSdk.LinkSdkRegressionTest.SpecialFolder() in [...]/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 900
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 9cbf14500b [tests] Ignore the XmlSerializationTest.Bug1820_GenericList test in .NET due to a linker bug.
Ref: https://github.com/mono/linker/issues/1454

Fixes this link sdk test failure:

    LinkSdk.Serialization.XmlSerializationTest
        [FAIL] Bug1820_GenericList : System.ArgumentNullException : Value cannot be null. (Parameter 'obj')
            at System.Reflection.Emit.ModuleBuilder.GetToken(MemberInfo member, Boolean create_open_instance)
            at System.Reflection.Emit.ModuleBuilderTokenGenerator.GetToken(MemberInfo member, Boolean create_open_instance)
            at System.Reflection.Emit.ILGenerator.Emit(OpCode opcode, ConstructorInfo con)
            at System.Xml.Serialization.CodeGenerator.Call(ConstructorInfo ctor)
            at System.Xml.Serialization.XmlSerializationILGen.GenerateSerializerContract(String className, XmlMapping[] xmlMappings, Type[] types, String readerType, String[] readMethods, String writerType, String[] writerMethods, Dictionary`2 serializers)
            at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace)
            at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location)
            at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace, String location)
            at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
            at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
            at System.Xml.Serialization.XmlSerializer..ctor(Type type)
            at LinkSdk.Serialization.XmlSerializationTest.Response.get_Serializer() in [...]/xamarin-macios/tests/linker/ios/link sdk/Bug1820Test.cs:line 38
            at LinkSdk.Serialization.XmlSerializationTest.Response.Deserialize(String xml) in [...]/xamarin-macios/tests/linker/ios/link sdk/Bug1820Test.cs:line 48
            at LinkSdk.Serialization.XmlSerializationTest.Bug1820_GenericList() in [...]/xamarin-macios/tests/linker/ios/link sdk/Bug1820Test.cs:line 166
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 39660b687c [tests] Assert that the Mono.Runtime type does *not* exist in .NET.
Fixes this link sdk test failure:

    LinkSdk.LinkSdkRegressionTest
        [FAIL] MonoRuntime34671 :   Mono.Runtime
            Expected: not null
            But was:  null
                at LinkSdk.LinkSdkRegressionTest.MonoRuntime34671() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 1007
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 14aefe5576 [tests] Adjust LinkSdkRegressionTest.PrivateMemorySize64 in .NET to expected values.
This fixes this link sdk test failure:

    LinkSdk.LinkSdkRegressionTest
        [FAIL] PrivateMemorySize64 :   PrivateMemorySize64
            Expected: not equal to 0
            But was:  0
                at LinkSdk.LinkSdkRegressionTest.PrivateMemorySize64() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 805
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge ae0649f4e5 [tests] Ignore LinkSdkRegressionTest.AsQueryable_Enumerable due to an issue in .NET
Ref: https://github.com/dotnet/runtime/issues/41392

Fixes this link sdk test failure:

    LinkSdk.LinkSdkRegressionTest
        [FAIL] AsQueryable_Enumerable : System.NullReferenceException : Object reference not set to an instance of an object
            at System.Linq.EnumerableRewriter.FindEnumerableMethod(String name, ReadOnlyCollection`1 args, Type[] typeArgs)
            at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
            at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
            at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
            at System.Linq.Expressions.ExpressionVisitor.Visit(ReadOnlyCollection`1 nodes)
            at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
            at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
            at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
            at System.Linq.EnumerableExecutor`1[[System.Linq.IGrouping`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].Execute()
            at System.Linq.EnumerableQuery`1[[System.Linq.IGrouping`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].System.Linq.IQueryProvider.Execute[IGrouping`2](Expression expression)
            at System.Linq.Queryable.FirstOrDefault[IGrouping`2](IQueryable`1 source)
            at LinkSdk.LinkSdkRegressionTest.AsQueryable_Enumerable() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 1100
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 75fbd970e0 [tests] Adjust LinkSdkRegressionTest.Pointer_5200 to work on .NET
Fixes this link sdk test failure:

    LinkSdk.LinkSdkRegressionTest
        [FAIL] Pointer_5200 :
            Expected: not null
            But was:  null
                at LinkSdk.LinkSdkRegressionTest.Pointer_5200() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs:line 696
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge c8b622917d [tests] Adjust LinkExtraDefsTest to work with .NET.
Fixes these link sdk test failures:

    LinkSdk.LinkExtraDefsTest
        [FAIL] Corlib :   System.Security.PermissionSet
            Expected: not null
            But was:  null
                at LinkSdk.LinkExtraDefsTest.Corlib() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkExtraDefsTest.cs:line 33

        [FAIL] System :   System.Net.Mime.ContentType
            Expected: not null
            But was:  null
                at LinkSdk.LinkExtraDefsTest.System() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/LinkExtraDefsTest.cs:line 40
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge dea6580c78 [tests] Ignore CommonLinkSdkTest.TypeDescriptor_A7793 in .NET due to a linker bug.
Ref: https://github.com/mono/linker/issues/1451

Fixes this link sdk test failure:

    LinkSdk.CommonLinkSdkTest
        [FAIL] TypeDescriptor_A7793 : System.MissingMethodException : Default constructor not found for type System.ComponentModel.DateTimeOffsetConverter
            at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
            at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
            at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
            at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
            at System.Activator.CreateInstance(Type type, Boolean nonPublic)
            at System.Activator.CreateInstance(Type type)
            at System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(Type objectType, Type callingType)
            at System.ComponentModel.ReflectTypeDescriptionProvider.SearchIntrinsicTable(Hashtable table, Type callingType)
            at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetConverter(Object instance)
            at System.ComponentModel.ReflectTypeDescriptionProvider.GetConverter(Type type, Object instance)
            at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter()
            at System.ComponentModel.TypeDescriptor.GetConverter(Type type)
            at LinkSdk.CommonLinkSdkTest.TypeDescriptor_A7793() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/CommonLinkSdkTest.cs:line 21
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 77f9a4d733 [tests] Ignore DllImportTest.LackOfCapget in .NET due to an issue in .NET.
System.Net.NetworkInformation.Ping.Send doesn't work.

Ref: https://github.com/dotnet/runtime/issues/41355

Fixes this link sdk test failure:

    LinkSdk.DllImportTest
        [FAIL] LackOfCapget :
            Expected: <System.InvalidOperationException>
            But was:  <System.Net.NetworkInformation.PingException: An exception occurred during a Ping request.
                ---> System.ComponentModel.Win32Exception (2): No such file or directory
                at System.Diagnostics.Process.EnsureInitialized()
                at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
                at System.Diagnostics.Process.Start()
                at System.Net.NetworkInformation.Ping.SendWithPingUtility(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
                at System.Net.NetworkInformation.Ping.SendPingCore(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
                at System.Net.NetworkInformation.Ping.GetAddressAndSend(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
                --- End of inner exception stack trace ---
                at System.Net.NetworkInformation.Ping.GetAddressAndSend(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
                at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
                at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer)
                at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress)
                at LinkSdk.DllImportTest.<>c__DisplayClass3_0.<LackOfCapget>b__0() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/DllImportTest.cs:line 88
                at NUnit.Framework.Assert.Throws(IResolveConstraint expression, TestDelegate code, String message, Object[] args)>
                at LinkSdk.DllImportTest.LackOfCapget() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link sdk/DllImportTest.cs:line 88
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge e8c389164d [tests] Disable link sdk tests that require Crypto for .NET.
Fixes these link sdk test failures:

    LinkSdk.CryptoTest
        [FAIL] AesCreate :   System.Core
            Expected: True
            But was:  False
                at LinkSdk.CryptoTest.AesCreate() in [...]/xamarin-macios/tests/linker/ios/link sdk/CryptoTest.cs:line 33

        [FAIL] Chain : System.EntryPointNotFoundException : AppleCryptoNative_SecKeychainCreate assembly:<unknown assembly> type:<unknown type> member:(null)
            at Interop.AppleCrypto.CreateOrOpenKeychain(String keychainPath, Boolean createAllowed)
            at Internal.Cryptography.Pal.StorePal.AppleKeychainStore.CreateOrOpenKeychain(String keychainPath, OpenFlags openFlags)
            at Internal.Cryptography.Pal.StorePal.FromCustomKeychainStore(String storeName, OpenFlags openFlags)
            at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
            at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
            at LinkSdk.CryptoTest.Chain() in [...]/xamarin-macios/tests/linker/ios/link sdk/CryptoTest.cs:line 149
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

        [FAIL] Sha256 : System.EntryPointNotFoundException : AppleCryptoNative_SecCopyErrorMessageString assembly:<unknown assembly> type:<unknown type> member:(null)
            at Interop.AppleCrypto.GetSecErrorString(Int32 osStatus)
            at Interop.AppleCrypto.CreateExceptionForOSStatus(Int32 osStatus)
            at Internal.Cryptography.Pal.X509Pal.AppleX509Pal.GetCertContentType(ReadOnlySpan`1 rawData)
            at System.Security.Cryptography.X509Certificates.X509Certificate2.GetCertContentType(ReadOnlySpan`1 rawData)
            at Internal.Cryptography.Pal.AppleCertificatePal.FromBlob(ReadOnlySpan`1 rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
            at Internal.Cryptography.Pal.CertificatePal.FromBlob(ReadOnlySpan`1 rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
            at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(ReadOnlySpan`1 data)
            at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data)
            at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)
            at LinkSdk.CryptoTest.Sha256() in [...]/xamarin-macios/tests/linker/ios/link sdk/CryptoTest.cs:line 228
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 6a2f1dbc29 [tests] Disable link sdk tests that require Crypto for .NET and which cause the test app to crash
Fixes unhandled exception that makes the app crash:

    Unhandled Exception:
    System.EntryPointNotFoundException: AppleCryptoNative_SecKeychainItemCopyKeychain assembly:<unknown assembly> type:<unknown type> member:(null)
       at Interop.AppleCrypto.SecKeychainItemCopyKeychain(IntPtr item)
       at System.Security.Cryptography.Apple.SafeTemporaryKeychainHandle.UntrackItem(IntPtr keychainItem)
       at System.Security.Cryptography.Apple.SafeKeychainItemHandle.ReleaseHandle()
       at System.Runtime.InteropServices.SafeHandle.InternalRelease(Boolean disposeOrFinalizeOperation)
       at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
       at System.Runtime.InteropServices.SafeHandle.Finalize()
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge a44fdae53d [tests] Ignore a link sdk test that calls MulticastDelegate.BeginInvoke.
MulticastDelegate.BeginInvoke isn't supported in .NET.

Ref: https://github.com/dotnet/runtime/issues/16312
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 3eeb46261a [tests] The HttpWebRequest constructors are not publicly available in .NET 5+, so use WebRequest.CreateHttp instead. 2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 7cf7f2d2d3 [tests] Exclude link sdk tests using API that isn't available anymore in .NET. 2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 7d7208c86d [tests] Exclude link sdk tests in .NET that reference OpenTK-1.0.dll
OpenTK-1.0.dll isn't supported yet.
2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 809a12647f [tests] Port link sdk to .NET 2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge 6a1e8acbb0
[tests] Adjust resources test to cope with the fact that only the invariant culture is currently shipping in .NET 5. (#9498)
Ref: https://github.com/xamarin/xamarin-macios/issues/8906

This is the third of three steps to fix this test failure:

    EmbeddedResources.ResourcesTest
        [FAIL] Embedded :   en-AU
            Expected string length 5 but was 7. Strings differ at index 0.
            Expected: "G'day"
            But was:  "Welcome"
            -----------^
                at EmbeddedResources.ResourcesTest.Embedded() in [...]/xamarin-macios/tests/EmbeddedResources/ResourcesTest.cs:line 45
2020-08-26 09:39:52 +02:00
Rolf Bjarne Kvinge 0a39dbc682
[dotnet] Make sure the 'BuildOnlySettings' target has been called before any other .NET target we depend on. (#9496)
The 'BuildOnlySettings' target flips a switch that indicates we're doing a
real build, which makes the .NET build logic resolve and publish satellite
assemblies (the switch probably controls a lot of other stuff as well, but
this is where I ran into it).

This is the first of three steps to fix this test failure:

EmbeddedResources.ResourcesTest
    [FAIL] Embedded :   en-AU
        Expected string length 5 but was 7. Strings differ at index 0.
        Expected: "G'day"
        But was:  "Welcome"
        -----------^
            at EmbeddedResources.ResourcesTest.Embedded() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/EmbeddedResources/ResourcesTest.cs:line 45
2020-08-26 08:00:52 +02:00
Rolf Bjarne Kvinge b097f7bbab
[tools] Honor the ENABLE_DOTNET variable. Fixes #9475. (#9502)
Fixes https://github.com/xamarin/xamarin-macios/issues/9475.
2020-08-26 07:59:46 +02:00
Rolf Bjarne Kvinge c0e16ef36d
[tests] Fix the don't link test on .NET. (#9501) 2020-08-26 07:58:53 +02:00
Rolf Bjarne Kvinge fb40d7e02f
[dotnet] Preserve relative directory when deciding where in the app bundle files should be copied. (#9497)
There may be multiple satellite assemblies with the same name, so make sure to
put them all in the corresponding subdirectory.

This is the second of three steps to fix this test failure:

    EmbeddedResources.ResourcesTest
        [FAIL] Embedded :   en-AU
            Expected string length 5 but was 7. Strings differ at index 0.
            Expected: "G'day"
            But was:  "Welcome"
            -----------^
                at EmbeddedResources.ResourcesTest.Embedded() in [...]/xamarin-macios/tests/EmbeddedResources/ResourcesTest.cs:line 45
2020-08-26 07:54:46 +02:00
monojenkins 3fe21bed66
[msbuild] Fix AdditionalAppExtensions entitlement logic (#9494)
- Fixes https://github.com/xamarin/xamarin-macios/issues/9458
- Defining the variable over multiple lines changes output to include incorrect newline
- Auto tests did not catch, as they don't sign on bots due to infrastructure issues.
- Was refactored _after_ manual tests and not retested

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2020-08-25 14:40:00 -05:00
Rolf Bjarne Kvinge 827591eccc
[tools] Extract the code to parse, validate and process exception marshalling arguments into the Application class. (#9492)
So that it's easier to re-use it from our .NET linker code.
2020-08-25 19:55:50 +02:00
Rolf Bjarne Kvinge d49f9d4236
[dotnet/msbuild] Add support for compiling and embedding entitlements to .NET apps. (#9489)
First move the logic to compute the linker arguments for embedding
entitlements into the executable to shared code, so that it can be used from
platform-agnostic .NET code as well.

There is one difference: the code no longer checks if we're building for the
simulator, because the 'CompiledEntitlements' variable won't be set unless
we're in the simulator, so it's no longer needed (it's also not applicable for
Xamarin.Mac).

Also call the _CompileEntitlements target from the .NET build logic, and embed
the result into the executable.

This fixes the following 10 monotouch-tests:

    MonoTouchFixtures.Security.CertificateTest
        [FAIL] GenerateKeyPairTest :   GenerateKeyPair
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.CertificateTest.GenerateKeyPairTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/CertificateTest.cs:line 597

    MonoTouchFixtures.Security.KeyChainTest
        [FAIL] AddQueryRemove_Identity :   code
            Expected: DuplicateItem or Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.AddQueryRemove_Identity() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 49

        [FAIL] Add_Certificate :   Add_Certificate
            Expected: Success or DuplicateItem
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.Add_Certificate() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 38

        [FAIL] CheckId :   same guid
            Expected: 00000000-0000-0000-0000-000000000000
            But was:  9c3f0fd6-5c94-46a3-8193-a9fb45209a48
                at MonoTouchFixtures.Security.KeyChainTest.CheckId() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 171

        [FAIL] SecItemAdd_Identity :   Expected: DuplicateItem or Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.SecItemAdd_Identity() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 91

    MonoTouchFixtures.Security.RecordTest
        [FAIL] Accessible_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.Accessible(SecAccessible access) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 56
                at MonoTouchFixtures.Security.RecordTest.Accessible_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 93

        [FAIL] AuthenticationType_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.AuthenticationType(SecAuthenticationType type) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 174
                at MonoTouchFixtures.Security.RecordTest.AuthenticationType_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 186

        [FAIL] DeskCase_83099_InmutableDictionary :   Password could not be saved to keychain
            Expected: True
            But was:  False
                at MonoTouchFixtures.Security.RecordTest.DeskCase_83099_InmutableDictionary() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 205

        [FAIL] IdentityRecordTest :   Identity added
            Expected: True
            But was:  False
                at MonoTouchFixtures.Security.RecordTest.IdentityRecordTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 294

        [FAIL] Protocol_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.Protocol(SecProtocol protocol) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 115
                at MonoTouchFixtures.Security.RecordTest.Protocol_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 127
2020-08-25 19:25:32 +02:00
Rolf Bjarne Kvinge 26ad21c1ad
[msbuild] Rework how we compute the input when compressing frameworks for binding projects. (#9486)
* Use ItemGroup inside a target, since using CreateItem is deprecated.
* Use target batching to make sure the _CompressNativeFrameworkResources
  target is called once per framework.
* Also add a comment for my future self describing the whole process, because
  I'll forget this by next week.

The end result is that we will now only re-compress a framework if any file in
that particular framework changed (as opposed to re-compressing all frameworks
in a binding project when any of them changed).
2020-08-25 19:25:13 +02:00
Rolf Bjarne Kvinge de8cc6bbd8
[dotnet-linker] Add Debug to the linker configuration. (#9491) 2020-08-25 18:40:59 +02:00
Rolf Bjarne Kvinge ebbd1e6738 [xharness] don't link is now green on .NET! 2020-08-25 18:18:34 +02:00
Rolf Bjarne Kvinge 90aaee0404 [tests] Ignore don't link tests that require globalization support.
.NET doesn't have any globalization support yet.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

This fixes these tests:

    DontLink.Calendars.CalendarTest
        [FAIL] Hijri :   Calendar
            Expected string length 34 but was 38. Strings differ at index 21.
            Expected: "System.Globalization.HijriCalendar"
            But was:  "System.Globalization.GregorianCalendar"
            --------------------------------^
                at DontLink.Calendars.CalendarTest.Hijri() in [...]/xamarin-macios/tests/linker/ios/dont link/CalendarTest.cs:line 28
        
        [FAIL] ThaiBuddhist :   Calendar
            Expected string length 41 but was 38. Strings differ at index 21.
            Expected: "System.Globalization.ThaiBuddhistCalendar"
            But was:  "System.Globalization.GregorianCalendar"
            --------------------------------^
                at DontLink.Calendars.CalendarTest.ThaiBuddhist() in [...]/xamarin-macios/tests/linker/ios/dont link/CalendarTest.cs:line 35
        
        [FAIL] UmAlQura :   Calendar
            Expected string length 37 but was 38. Strings differ at index 21.
            Expected: "System.Globalization.UmAlQuraCalendar"
            But was:  "System.Globalization.GregorianCalendar"
            --------------------------------^
                at DontLink.Calendars.CalendarTest.UmAlQura() in [...]/xamarin-macios/tests/linker/ios/dont link/CalendarTest.cs:line 21
2020-08-25 18:18:34 +02:00
Rolf Bjarne Kvinge 5f1c5c5e92 [tests] Adjust don't link's TypeDescriptorCanary to take into account that .NET has new converters. 2020-08-25 18:18:34 +02:00
Rolf Bjarne Kvinge be66baad9e [tests] Modify don't link's TypeDescriptorCanary to find System.ComponentModel.ReflectTypeDescriptionProvider in the same assembly BooleanConverter is.
Types have moved around in .NET, and in particular
System.ComponentModel.ReflectTypeDescriptionProvider is not in System where it
once was. So change the logic to look in the same assembly
System.ComponentModel.BooleanConverter is, as opposed to hardcoding 'System'.

This fixes this test:

    DontLink.CommonDontLinkTest
        [FAIL] TypeDescriptorCanary :   type
        Expected: not null
        But was:  null
            at DontLink.CommonDontLinkTest.TypeDescriptorCanary() in [...]/xamarin-macios/tests/linker/CommonDontLinkTest.cs:line 19
2020-08-25 18:18:34 +02:00
Rolf Bjarne Kvinge 87efe8625d [tests] Ignore a don't link test that calls MulticastDelegate.BeginInvoke.
MulticastDelegate.BeginInvoke isn't supported in .NET.

Ref: https://github.com/dotnet/runtime/issues/16312

Fixes this test failure:

    DontLink.DontLinkRegressionTests
    [FAIL] Bug5354 : System.PlatformNotSupportedException : Operation is not supported on this platform.
        at DontLink.DontLinkRegressionTests.Bug5354() in [...]/xamarin-macios/tests/linker/ios/dont link/DontLinkRegressionTests.cs:line 64
        at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-08-25 18:18:34 +02:00