Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FreshTinyIoC.TinyIoCResolutionException: Resolve failed: MainPage - Reason: The BindableProperty "BackgroundGradientStops" is readonly. #45

Closed
gregmercer opened this issue Sep 20, 2019 · 1 comment

Comments

@gregmercer
Copy link

I was getting the following crash when trying to run the example app.

FreshTinyIoC.TinyIoCResolutionException: Resolve failed: MainPage - Reason: The BindableProperty "BackgroundGradientStops" is readonly. ---> System.InvalidOperationException: The BindableProperty "BackgroundGradientStops" is readonly.
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0001a] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:293
  at Xamarin.Forms.PancakeView.PancakeView.set_BackgroundGradientStops (System.Collections.Generic.IList`1[T] value) [0x00001] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/src/Xamarin.Forms.PancakeView.Multi/Platforms/Shared/PancakeView.cs:76
  at Thewissen.PancakeViewSample.Pages.MainPage.InitializeComponent () [0x00012] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/example/Thewissen.PancakeViewSample/obj/Debug/netstandard2.0/Pages/MainPage.xaml.g.cs:22
  at Thewissen.PancakeViewSample.Pages.MainPage..ctor () [0x00008] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/example/Thewissen.PancakeViewSample/Pages/MainPage.xaml.cs:14
  at at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:882
  --- End of inner exception stack trace ---
  at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x00164] in C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:3388
  at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x00000] in C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:3314
  at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x001b2] in C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:3175
  at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType) [0x00000] in C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:1184
  at FreshMvvm.FreshTinyIOCBuiltIn.Resolve (System.Type resolveType) [0x00000] in C:\Projects\FreshMvvm\src\FreshMvvm\FreshTinyIOCBuiltIn.cs:48
  at FreshMvvm.FreshPageModelResolver.ResolvePageModel (System.Type type, System.Object data, FreshMvvm.FreshBasePageModel pageModel) [0x0002d] in C:\Projects\FreshMvvm\src\FreshMvvm\FreshPageModelResolver.cs:41
  at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object data, T pageModel) [0x0000b] in C:\Projects\FreshMvvm\src\FreshMvvm\FreshPageModelResolver.cs:25
  at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object initData) [0x0000b] in C:\Projects\FreshMvvm\src\FreshMvvm\FreshPageModelResolver.cs:19
  at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] () [0x00000] in C:\Projects\FreshMvvm\src\FreshMvvm\FreshPageModelResolver.cs:12
  at Thewissen.PancakeViewSample.App..ctor () [0x0000f] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/example/Thewissen.PancakeViewSample/App.xaml.cs:15
  at Thewissen.PancakeViewSample.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00007] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/example/Thewissen.PancakeViewSample.iOS/AppDelegate.cs:23
  at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:86
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:65
  at Thewissen.PancakeViewSample.iOS.Application.Main (System.String[] args) [0x00001] in /Users/gregmercer/Desktop/gsbgo/Experiments/Xamarin.Forms.PancakeView/example/Thewissen.PancakeViewSample.iOS/Main.cs:17

If I changed MainPage to the following, then the example app was able to run.

diff --git a/example/Thewissen.PancakeViewSample/Pages/MainPage.xaml b/example/Thewissen.PancakeViewSample/Pages/MainPage.xaml
index 8e18490..b85f927 100644
--- a/example/Thewissen.PancakeViewSample/Pages/MainPage.xaml
+++ b/example/Thewissen.PancakeViewSample/Pages/MainPage.xaml
@@ -16,7 +16,15 @@
             <yummy:PancakeView BackgroundGradientStartColor="#FF33AA" BackgroundGradientEndColor="#f7e843" BackgroundGradientAngle="45" HorizontalOptions="FillAndExpand" HeightRequest="150" CornerRadius="10" />
             <Label Margin="0,32,0,0" Text="MULTI-COLOR GRADIENT BACKGROUNDS" FontFamily="{StaticResource LatoBold}" HorizontalOptions="Center" HorizontalTextAlignment="Center" />
             <Label Text="Create good-looking multi-colored gradients too!" FontFamily="{StaticResource LatoRegular}" FontSize="14" Margin="0,8,0,16" HorizontalOptions="Center" HorizontalTextAlignment="Center" />
-            <yummy:PancakeView BackgroundGradientAngle="45" HorizontalOptions="FillAndExpand" HeightRequest="150" CornerRadius="10" BackgroundGradientStops="{StaticResource Rainbow}" />
+            <yummy:PancakeView BackgroundGradientAngle="45" HorizontalOptions="FillAndExpand" HeightRequest="150" CornerRadius="10" >
+                <yummy:PancakeView Opacity="0.7">
+                    <yummy:PancakeView.BackgroundGradientStops>
+                        <yummy:GradientStop Color="#000000" Offset="0" />
+                        <yummy:GradientStop Color="Transparent" Offset="0.5" />
+                        <yummy:GradientStop Color="#000000" Offset="1" />
+                    </yummy:PancakeView.BackgroundGradientStops>
+                </yummy:PancakeView>
+            </yummy:PancakeView>
             <Label Margin="0,32,0,0" Text="ROUNDED CORNERS" FontFamily="{StaticResource LatoBold}" HorizontalOptions="Center" HorizontalTextAlignment="Center" />
             <Label Text="Round each corner individually or simply round them all the same. Content is clipped." FontFamily="{StaticResource LatoRegular}" FontSize="14" Margin="0,8,0,16" HorizontalOptions="Center" HorizontalTextAlignment="Center" />
             <yummy:PancakeView BackgroundColor="Purple" BorderThickness="4" CornerRadius="40,0,0,100" HorizontalOptions="FillAndExpand" HeightRequest="150">
@sthewissen
Copy link
Owner

Should be fixed in 1.3.2-beta.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants