Skip to content

Conversation

@grendello
Copy link
Contributor

Cherry-pick 36d7e73 which is one of the fixes for the AndroidClientHandler Timeout issues.

jonpryor and others added 7 commits February 24, 2017 22:08
(Commercial) Xamarin.Android v7.2 is being tracked in the
[xamarin-android/d15-1][0] branch, which was branched from
commit 1a23303.

[0]: https://github.com/xamarin/xamarin-android/commits/d15-1
…et#499)

- preserve the static ICustomMarshaler GetInstance (string) method
   of types implementing ICustomMarshaler interface

 - it avoids errors like:

         ReadlinkTest
         	ReadLink [FAIL] : System.ApplicationException : Custom marshaler 'FileNameMarshaler' does not implement a static GetInstance method that takes a single string parameter and returns an ICustomMarshaler.
         		  at (wrapper managed-to-native) Mono.Unix.Native.Syscall:readlinkat (int,string,byte[],ulong)
         		  at Mono.Unix.Native.Syscall.readlinkat (System.Int32 dirfd, System.String pathname, System.Byte[] buf) [0x0000a] in <75558c6e0e1f444f8a03d1c694a92a08>:0
         		  at MonoTests.Mono.Unix.ReadlinkTest.SetUp () [0x00007] in <9df8009b87984e1cb863e771d21f9f39>:0
         		  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
         		  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <9f55149ed93f4bad9226ce1d7634fe5b>:0
         	readlink_byte [FAIL] : System.ApplicationException : Custom marshaler 'FileNameMarshaler' does not implement a static GetInstance method that takes a single string parameter and returns an ICustomMarshaler.
         TearDown : System.ArgumentException : ** Unknown error code: 9**
           ----> Mono.Unix.UnixIOException : ** Unknown error code: 9** [EBADF].
         		  at (wrapper managed-to-native) Mono.Unix.Native.Syscall:readlinkat (int,string,byte[],ulong)
         		  at Mono.Unix.Native.Syscall.readlinkat (System.Int32 dirfd, System.String pathname, System.Byte[] buf) [0x0000a] in <75558c6e0e1f444f8a03d1c694a92a08>:0
         		  at MonoTests.Mono.Unix.ReadlinkTest.SetUp () [0x00007] in <9df8009b87984e1cb863e771d21f9f39>:0
         		  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
         		  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <9f55149ed93f4bad9226ce1d7634fe5b>:0
         		--TearDown
         		  at Mono.Unix.UnixMarshal.ThrowExceptionForLastError () [0x00006] in <75558c6e0e1f444f8a03d1c694a92a08>:0
         		  at MonoTests.Mono.Unix.ReadlinkTest.TearDown () [0x00011] in <9df8009b87984e1cb863e771d21f9f39>:0
         		  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
         		  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <9f55149ed93f4bad9226ce1d7634fe5b>:0
         		--UnixIOException
dotnet#504)

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=53163

A user uncovered an issue using the Xamarin.Forms previewer where
libmonosgen failed to load correctly on Windows.

The root cause was that the already loaded libmono-android was
incompatible with the version of mono being loaded (different bridge
versions) causing a forced runtime shutdown with the error message:

    Invalid bridge callback version. Expected 4 but got 5

After investigating, it turns out the user had an old version of
Xamarin installed via MSI (for VS2015) on his machine and was
trying to use the newer Xamarin embedded in VS2017 via the Willow
distribution mechanism which places binaries such as libmonosgen
in a separate directory structure.

Thus the problem was that, while libmono-android itself was loaded
correctly from that separate path, the code was then trying to
fetch libmonosgen from the global system path (now completely
obsolete) causing the bridge version mismatch.

With this patch, the code will now try first to get libmonosgen
from the same directory libmono-android was loaded from which
should cover the Willow case.
…y open files" when building a large app with AOT and all supported architectures (dotnet#493) (dotnet#516)

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=53122

There is a problem with libzip in that is does not have an
API for Flushing the current items in memory to disk.
This was why ZipArchiveEx was introduced in commit 9166e03.
This commit reworks the BuildApk task to make sure of this
new functinality and to periodically flush the zip to disk.
This will reduce the chances of running out of memory.

It also adds a unit test which generates and builds an app
which has a large number of refernces and assets. This app
also gets AOT'd so it should be pushing the system to the limit.

Also added code to make sure the cross tools and llc have
execute permissions.

Added code to make sure we dispose of each process in the Aapt and
Aot tasks. This is to ensure any files or pipes these processed have
are removed as soon as possible.

Updated the unix-distribution-setup.targets to ensure that the cross-arm
tooling and llc have the correct execute permissions on MacOS and Linux.
The `HttpURLConnection.ConnectAsync` API doesn't accept a `CancellationToken`
instance and, thus, cannot be easily cancelled in a graceful manner. This
limitation resulted in using the `Task.WhenAny` to make sure the connection
attempt is aborted whenever the calling task is cancelled. This, however, led to
a problem of unobserved exceptions should the cancellation occur before the
connection attempt was successful.

This commit wraps the synchronous `HttpURLConnection.Connect` call in a task
that is passed the cancellation token, so that it can be gracefully cancelled
when needed. The cancellation is done by registering a handler for when token is
about to expire as Task.Run will check if cancellation was requested only before
it runs the passed code, the rest is the code's responsibility.
Since `URLConnection.Connect()` is asynchronous we abort it by calling
`Disconnect()` on the instance which is a brutal but effective way to interrupt
the connection attempt.

Additionally, the diff makes sure to properly configure a few tasks for `await`

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51804
@grendello grendello closed this Mar 23, 2017
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Nov 19, 2019
Changes: dotnet/java-interop@baf43b0...166a6c9

Fixes: dotnet/java-interop#519

  * dotnet/java-interop@166a6c9: [Java.Interop-Tests] Remove Reflection from JavaPrimitiveArrayContract (dotnet#521)
  * dotnet/java-interop@09083d9: [generator] Support empty package names (dotnet#520)
  * dotnet/java-interop@af3dc77: [build] Set up YAML Azure pipeline. (dotnet#516)
  * dotnet/java-interop@8602581: [java-interop] Enabling -fPIC on Linux build - part 2 (dotnet#518)
  * dotnet/java-interop@ff3081d: [build] Migrate library projects to SDK style + netstandard2.0 (dotnet#507)
  * dotnet/java-interop@f5d29c3: [generator] Ensure all usage of parameter names are escaped the same (dotnet#506)
  * dotnet/java-interop@17cdf54: Add vscode files so we can build/debug/test from inside the vscode ide (dotnet#513)
jonpryor added a commit that referenced this pull request Nov 20, 2019
Changes: dotnet/java-interop@baf43b0...166a6c9

Fixes: dotnet/java-interop#519

  * dotnet/java-interop@166a6c9: [Java.Interop-Tests] Remove Reflection from JavaPrimitiveArrayContract (#521)
  * dotnet/java-interop@09083d9: [generator] Support empty package names (#520)
  * dotnet/java-interop@af3dc77: [build] Set up YAML Azure pipeline. (#516)
  * dotnet/java-interop@8602581: [java-interop] Enabling -fPIC on Linux build - part 2 (#518)
  * dotnet/java-interop@ff3081d: [build] Migrate library projects to SDK style + netstandard2.0 (#507)
  * dotnet/java-interop@f5d29c3: [generator] Ensure all usage of parameter names are escaped the same (#506)
  * dotnet/java-interop@17cdf54: Add vscode files so we can build/debug/test from inside the vscode ide (#513)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants