Skip to content

Commit 6cf9932

Browse files
committed
Initial commit.
0 parents  commit 6cf9932

File tree

7 files changed

+162
-0
lines changed

7 files changed

+162
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.vs
2+
bin
3+
obj
4+
packages
5+

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
all:
2+
nuget restore
3+
msbuild

Program.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using Mono.Cecil;
3+
namespace fixbindinglibrary {
4+
class MainClass {
5+
public static void Main (string [] args)
6+
{
7+
foreach (var arg in args) {
8+
Console.WriteLine ("Processing {0}", arg);
9+
var ad = AssemblyDefinition.ReadAssembly (arg, new ReaderParameters () { InMemory = true });
10+
foreach (var type in ad.MainModule.Types) {
11+
if (!type.HasCustomAttributes)
12+
continue;
13+
var hasProtocolAttribute = false;
14+
CustomAttribute registerAttribute = null;
15+
foreach (var ca in type.CustomAttributes) {
16+
if (ca.AttributeType.Namespace != "Foundation")
17+
continue;
18+
19+
switch (ca.AttributeType.Name) {
20+
case "ProtocolAttribute":
21+
hasProtocolAttribute = true;
22+
break;
23+
case "RegisterAttribute":
24+
registerAttribute = ca;
25+
break;
26+
}
27+
}
28+
if (!hasProtocolAttribute)
29+
continue;
30+
if (registerAttribute == null)
31+
continue;
32+
Console.WriteLine ("Fixing {0}", type.FullName);
33+
registerAttribute.ConstructorArguments [1] = new CustomAttributeArgument (registerAttribute.ConstructorArguments [1].Type, false);
34+
}
35+
ad.Write (arg);
36+
Console.WriteLine ("Processed {0} successfully", arg);
37+
}
38+
}
39+
}
40+
}

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Workaround for breaking change in Xamarin.iOS 11.10
2+
---------------------------------------------------
3+
4+
More information about the breaking change can be found [here](https://developer.xamarin.com/releases/ios/xamarin.ios_11/xamarin.ios_11.10/#More_information_about_3832).
5+
6+
The fix is to rebuild any binding library with a recent-ish version of
7+
Xamarin.iOS (any version from the last couple of years should be enough).
8+
9+
If the source code isn't available for the library, this tool can be used to
10+
fix it, by passing the library as a command-line argument to the tool.
11+
12+
1. Build the tool:
13+
14+
```shell
15+
$ make
16+
```
17+
18+
2. Pass the library to the tool (the library will be saved in the same location):
19+
20+
```shell
21+
$ mono bin/Debug/fix-binding-library.exe /Users/rolf/Downloads/coreplot-1.5.1.2/lib/ios-unified/CorePlotiOS.dll
22+
Processing /Users/rolf/Downloads/coreplot-1.5.1.2/lib/ios-unified/CorePlotiOS.dll
23+
Fixing CorePlot.CPTAnimationDelegate
24+
Fixing CorePlot.CPTAxisDelegate
25+
Fixing CorePlot.CPTBarPlotDataSource
26+
Fixing CorePlot.CPTBarPlotDelegate
27+
Fixing CorePlot.CPTLegendDelegate
28+
Fixing CorePlot.CPTPieChartDataSource
29+
Fixing CorePlot.CPTPieChartDelegate
30+
Fixing CorePlot.CPTPlotDataSource
31+
Fixing CorePlot.CPTPlotDelegate
32+
Fixing CorePlot.CPTPlotAreaDelegate
33+
Fixing CorePlot.CPTPlotSpaceDelegate
34+
Fixing CorePlot.CPTRangePlotDataSource
35+
Fixing CorePlot.CPTRangePlotDelegate
36+
Fixing CorePlot.CPTResponder
37+
Fixing CorePlot.CPTScatterPlotDataSource
38+
Fixing CorePlot.CPTScatterPlotDelegate
39+
Fixing CorePlot.CPTTradingRangePlotDataSource
40+
Fixing CorePlot.CPTTradingRangePlotDelegate
41+
Processed /Users/rolf/Downloads/coreplot-1.5.1.2/lib/ios-unified/CorePlotiOS.dll successfully
42+
```

fix-binding-library.csproj

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
6+
<ProjectGuid>{8FEA3B22-C021-41C4-85AB-06E48299BFC9}</ProjectGuid>
7+
<OutputType>Exe</OutputType>
8+
<RootNamespace>fixbindinglibrary</RootNamespace>
9+
<AssemblyName>fix-binding-library</AssemblyName>
10+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
13+
<DebugSymbols>true</DebugSymbols>
14+
<DebugType>full</DebugType>
15+
<Optimize>false</Optimize>
16+
<OutputPath>bin\Debug</OutputPath>
17+
<DefineConstants>DEBUG;</DefineConstants>
18+
<ErrorReport>prompt</ErrorReport>
19+
<WarningLevel>4</WarningLevel>
20+
<ExternalConsole>true</ExternalConsole>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
23+
<Optimize>true</Optimize>
24+
<OutputPath>bin\Release</OutputPath>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
<ExternalConsole>true</ExternalConsole>
28+
</PropertyGroup>
29+
<ItemGroup>
30+
<Reference Include="System" />
31+
<Reference Include="Mono.Cecil">
32+
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.dll</HintPath>
33+
</Reference>
34+
<Reference Include="Mono.Cecil.Mdb">
35+
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
36+
</Reference>
37+
<Reference Include="Mono.Cecil.Pdb">
38+
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Mono.Cecil.Rocks">
41+
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
42+
</Reference>
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="Program.cs" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<None Include="packages.config" />
49+
</ItemGroup>
50+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
51+
</Project>

fix-binding-library.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fix-binding-library", "fix-binding-library.csproj", "{8FEA3B22-C021-41C4-85AB-06E48299BFC9}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
9+
Release|iPhoneSimulator = Release|iPhoneSimulator
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{8FEA3B22-C021-41C4-85AB-06E48299BFC9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
13+
{8FEA3B22-C021-41C4-85AB-06E48299BFC9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
14+
{8FEA3B22-C021-41C4-85AB-06E48299BFC9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
15+
{8FEA3B22-C021-41C4-85AB-06E48299BFC9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
16+
EndGlobalSection
17+
EndGlobal

packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Mono.Cecil" version="0.10.0" targetFramework="net461" />
4+
</packages>

0 commit comments

Comments
 (0)