Skip to content
This repository was archived by the owner on Apr 10, 2018. It is now read-only.

Commit 0ec68ed

Browse files
committed
Next take on #57: Use DeclaredFields instead of GetDeclaredField, as it should fix the problem according to zevsst. We now use the USE_TYPEINFO variant for iOS.
1 parent edf30be commit 0ec68ed

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

RestSharp.Portable.HttpClient.Shared/Impl/DefaultHttpClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public DefaultHttpClientFactory(bool setCredentials)
4545
if (_proxyProperty == null)
4646
{
4747
#if USE_TYPEINFO
48-
var proxyField = typeof(HttpClientHandler).GetTypeInfo().GetDeclaredField("proxy");
48+
var proxyField = typeof(HttpClientHandler).GetTypeInfo().DeclaredFields.FirstOrDefault(x => x.Name == "proxy" && x.IsPrivate);
4949
#else
5050
var proxyField = typeof(HttpClientHandler).GetField("proxy", BindingFlags.NonPublic | BindingFlags.Instance);
5151
#endif

RestSharp.Portable.HttpClient.iOS/RestSharp.Portable.HttpClient.iOS.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<DebugType>full</DebugType>
2020
<Optimize>false</Optimize>
2121
<OutputPath>bin\iPhone\Debug</OutputPath>
22-
<DefineConstants>DEBUG</DefineConstants>
22+
<DefineConstants>DEBUG;__UNIFIED__;__MOBILE__;__IOS__;USE_TYPEINFO</DefineConstants>
2323
<ErrorReport>prompt</ErrorReport>
2424
<WarningLevel>4</WarningLevel>
2525
<ConsolePause>false</ConsolePause>
@@ -38,13 +38,17 @@
3838
<CodesignKey>iPhone Developer</CodesignKey>
3939
<DocumentationFile>bin\iPhone\Release\RestSharp.Portable.HttpClient.xml</DocumentationFile>
4040
<CodeAnalysisRuleSet>..\ReleaseRules.ruleset</CodeAnalysisRuleSet>
41+
<DefineConstants>__UNIFIED__;__MOBILE__;__IOS__;USE_TYPEINFO</DefineConstants>
4142
</PropertyGroup>
4243
<PropertyGroup>
4344
<SignAssembly>true</SignAssembly>
4445
</PropertyGroup>
4546
<PropertyGroup>
4647
<AssemblyOriginatorKeyFile>..\RestSharp.Portable.snk</AssemblyOriginatorKeyFile>
4748
</PropertyGroup>
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
50+
<DefineConstants>__UNIFIED__;__MOBILE__;__IOS__;USE_TYPEINFO</DefineConstants>
51+
</PropertyGroup>
4852
<ItemGroup>
4953
<Compile Include="..\GlobalAssemblyInfo.cs">
5054
<Link>Properties\GlobalAssemblyInfo.cs</Link>

0 commit comments

Comments
 (0)