Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit fb8c094

Browse files
TheCodeTravelerpictosjfversluis
authored
Add #region to specify Linker Work-Around (#920)
* Add #region to specify Linker work-around * Update Xamarin.CommunityToolkit.csproj Co-authored-by: Pedro Jesus <[email protected]> Co-authored-by: Gerald Versluis <[email protected]> Co-authored-by: Gerald Versluis <[email protected]>
1 parent 1213775 commit fb8c094

File tree

9 files changed

+18
-1
lines changed

9 files changed

+18
-1
lines changed

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/IconTintColor/IconTintColorEffectRouter.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ public class IconTintColorEffectRouter : RoutingEffect
77
public IconTintColorEffectRouter()
88
: base(EffectIds.IconTintColor)
99
{
10+
#region Required work-around to prevent linker from removing the platform-specific implementation
1011
#if __ANDROID__
1112
if (System.DateTime.Now.Ticks < 0)
1213
_ = new Xamarin.CommunityToolkit.Android.Effects.IconTintColorEffectRouter();
1314
#elif __IOS__
1415
if (System.DateTime.Now.Ticks < 0)
1516
_ = new Xamarin.CommunityToolkit.iOS.Effects.IconTintColorEffectRouter();
1617
#endif
18+
#endregion
1719
}
1820
}
1921
}

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/RemoveBorder/RemoveBorderEffect.shared.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ public class RemoveBorderEffect : RoutingEffect
88
public RemoveBorderEffect()
99
: base(EffectIds.RemoveBorder)
1010
{
11+
#region Required work-around to prevent linker from removing the platform-specific implementation
12+
1113
#if __IOS__
1214
if (DateTime.Now.Ticks < 0)
1315
_ = new Xamarin.CommunityToolkit.iOS.Effects.RemoveBorderEffect();
1416
#elif __ANDROID__
1517
if (DateTime.Now.Ticks < 0)
1618
_ = new Xamarin.CommunityToolkit.Android.Effects.RemoveBorderEffect();
1719
#endif
20+
#endregion
1821
}
1922
}
2023
}

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/SafeArea/SafeAreaEffectRouter.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ public class SafeAreaEffectRouter : RoutingEffect
88
public SafeAreaEffectRouter()
99
: base(EffectIds.SafeArea)
1010
{
11+
#region Required work-around to prevent linker from removing the platform-specific implementation
1112
#if __IOS__
1213
if (DateTime.Now.Ticks < 0)
1314
_ = new Xamarin.CommunityToolkit.iOS.Effects.SafeAreaEffectRouter();
1415
#endif
16+
#endregion
1517
}
1618
}
1719
}

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/SelectAllText/SelectAllTextEffect.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ public class SelectAllTextEffect : RoutingEffect
88
public SelectAllTextEffect()
99
: base(EffectIds.SelectAllText)
1010
{
11+
#region Required work-around to prevent linker from removing the platform-specific implementation
1112
#if __IOS__
1213
if (DateTime.Now.Ticks < 0)
1314
_ = new Xamarin.CommunityToolkit.iOS.Effects.SelectAllTextEffect();
1415
#elif __ANDROID__
1516
if (DateTime.Now.Ticks < 0)
1617
_ = new Xamarin.CommunityToolkit.Android.Effects.SelectAllTextEffect();
1718
#endif
19+
#endregion
1820
}
1921
}
2022
}

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/TouchEffect.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ public event EventHandler<TouchCompletedEventArgs> Completed
467467
public TouchEffect()
468468
: base(EffectIds.TouchEffect)
469469
{
470+
#region Required work-around to prevent linker from removing the platform-specific implementation
470471
#if __ANDROID__
471472
if (System.DateTime.Now.Ticks < 0)
472473
_ = new Xamarin.CommunityToolkit.Android.Effects.PlatformTouchEffect();
@@ -483,6 +484,7 @@ public TouchEffect()
483484
if (System.DateTime.Now.Ticks < 0)
484485
_ = new Xamarin.CommunityToolkit.UWP.Effects.PlatformTouchEffect();
485486
#endif
487+
#endregion
486488
}
487489

488490
public static bool GetIsAvailable(BindableObject bindable)

src/CommunityToolkit/Xamarin.CommunityToolkit/Extensions/TranslateExtension.shared.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ public class TranslateExtension : IMarkupExtension<BindingBase>
1717
public BindingBase ProvideValue(IServiceProvider serviceProvider)
1818
{
1919
#if !NETSTANDARD1_0
20-
20+
#region Required work-around to prevent linker from removing the implementation
2121
if (DateTime.Now.Ticks < 0)
2222
_ = LocalizationResourceManager.Current[Text];
23+
#endregion
2324

2425
var binding = new Binding
2526
{

src/CommunityToolkit/Xamarin.CommunityToolkit/Views/RangeSlider/ThumbFrame.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ sealed class ThumbFrame : Frame
66
{
77
public ThumbFrame()
88
{
9+
#region Required work-around to prevent linker from removing the platform-specific implementation
910
#if __ANDROID__
1011
if (System.DateTime.Now.Ticks < 0)
1112
_ = new ThumbFrameRenderer(null);
1213
#endif
14+
#endregion
1315
}
1416
}
1517
}

src/CommunityToolkit/Xamarin.CommunityToolkit/Views/SideMenuView/SideMenuView.shared.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ public static readonly BindableProperty MenuGestureEnabledProperty
8989

9090
public SideMenuView()
9191
{
92+
#region Required work-around to prevent linker from removing the platform-specific implementation
9293
#if __ANDROID__
9394
if (System.DateTime.Now.Ticks < 0)
9495
_ = new Xamarin.CommunityToolkit.Android.UI.Views.SideMenuViewRenderer(null);
9596
#elif __IOS__
9697
if (System.DateTime.Now.Ticks < 0)
9798
_ = new Xamarin.CommunityToolkit.iOS.UI.Views.SideMenuViewRenderer();
9899
#endif
100+
#endregion
99101
}
100102

101103
public new ISideMenuList<View> Children

src/CommunityToolkit/Xamarin.CommunityToolkit/Xamarin.CommunityToolkit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<DebugType>portable</DebugType>
3232
<Configurations>Debug;Release</Configurations>
3333
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
34+
<NoWarn>SA1123</NoWarn>
3435
</PropertyGroup>
3536
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
3637
<!-- Manage TargetFrameworks for development (Debug Mode) -->

0 commit comments

Comments
 (0)