Skip to content

Instantly share code, notes, and snippets.

View jonpryor's full-sized avatar

Jonathan Pryor jonpryor

View GitHub Profile
using System.Collections.Generic;
interface IFruit {
string Name {get;}
}
class Banana : IFruit {
public string Name => "Banana";
}
@jonpryor
jonpryor / Java.Interop.diff
Created February 15, 2024 21:17
Assemblies & build variations, oh my!
diff --git a/src/Java.Interop/Java.Interop.csproj b/src/Java.Interop/Java.Interop.csproj
index 43d5937e3..f93e38e6a 100644
--- a/src/Java.Interop/Java.Interop.csproj
+++ b/src/Java.Interop/Java.Interop.csproj
@@ -22,14 +22,15 @@
<Import Project="..\..\TargetFrameworkDependentValues.props" />
<PropertyGroup>
<DefineConstants>INTEROP;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)</DefineConstants>
- <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
- <OutputPath>$(ToolOutputFullPath)</OutputPath>
diff --git a/beg.il b/end.il
index 7be9c831..716d50bc 100644
--- a/beg.il
+++ b/end.il
@@ -83,7 +83,7 @@
.custom instance void [System.Runtime]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 19 4A 61 76 61 2E 49 6E 74 65 72 6F 70 2E // ...Java.Interop.
45 78 70 6F 72 74 2D 54 65 73 74 73 00 00 ) // Export-Tests..
.permissionset reqmin
- = {[System.Runtime]System.Security.Permissions.SecurityPermissionAttribute = {}}
+ = {class 'System.Security.Permissions.SecurityPermissionAttribute, System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' = {}}

Managing Asynchronously

There's managing, then there's managing remotely, then there's managing asynchronously. A goal of "managing" is to serve as a liaison between your company and your direct reports, ensuring that the goals of all parties are fulfilled. It is a constant balancing act.

Managing remotely is management without physical presence. The difficulty is increased; lack of physical presence makes it more difficult to build rapport with directs. Lack of in-person communication cues can make conversations more difficult.

Managing asynchronously is managing remotely, with fewer (or no) timezone constraints. One can imagine managing a team with everyone in the same timezone. Once multiple timezones across multiple continents enter the picture, workflows which are straightforward when managing remotely no longer scale.

Many open source projects embody asynchronous work. If you have worked with such projects in the past, you will find that many of the techniques are applicable.

<Project>
<PropertyGroup>
<InvalidVersion>1.2.3a4</InvalidVersion>
<IsValid Condition="$([System.Version]::TryParse(
'$(InvalidVersion)',
$([System.Version]::Parse('1.2.3.4'))
))">True</IsValid>
</PropertyGroup>
<Target Name="Foo">
<Message Text="IsValid=$(IsValid)" Importance="High" />
<Project>
<PropertyGroup>
<IsNet6IosCompatibleWithNet6 Condition="$([MSBuild]::IsTargetFrameworkCompatible('net6.0', 'net6.0-ios'))">Yes</IsNet6IosCompatibleWithNet6>
</PropertyGroup>
<Target Name="Foo">
<Message Text="IsNet6IosCompatibleWithNet6=$(IsNet6IosCompatibleWithNet6)" />
</Target>
</Project>
diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs b/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
index e4548923d..851e4fb83 100644
--- a/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
@@ -12,6 +12,7 @@ using Microsoft.Build.Utilities;
using Java.Interop.Tools.Diagnostics;
using Xamarin.Android.Tools;
+using Microsoft.Android.Build.Tasks;
using System;
using System.IO;
class App {
public static void Main (string[] args)
{
foreach (var file in args) {
var content = File.ReadAllText (file);
var lines = content.Split ('\n');
foreach (var line in lines) {
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static void Main()
{
var markers = new[]{
(a: 1, s: "a"),

Installation of Native Libraries

An Android .apk file can contain native libraries for one or more architectures. Historically, all native libraries for the target device are extracted at .apk installation time. This would result in two copies of native libraries on the target device: a set of native libraries which are stored compressed within the .apk, and a separate set of native libraries on the Android target filesystem.

Starting with Android v6.0 (API-23), Android added an ability for