System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
<syncTheme:SyncfusionThemeDictionary>
<syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
<syncTheme:LightTheme x:Name="LightTheme" />
<syncfusion:SfScheduleStyles /> <------- This line in particular is the one that causes the reflection exception noted above.
<ResourceDictionary>
<Color x:Key="SfScheduleMonthCellBackgroundColor">RedColor>
ResourceDictionary>
syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
syncTheme:SyncfusionThemeDictionary>
If I try to use the resource content above, the page loads with a non-informative reflection exception. I've tried picking apart the resource to see if any one part of it is causing the issue. So far, only commenting the whole block out seems to get the page to not crash.
I do have a custom BaseView that all my pages inherit from, but I don't believe that is the problem.
The page is structured as follows:
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="com.XXX.MyApp.PhoneViews.CalendarPage"
xmlns:local="clr-namespace:com.XXX.MyApp"
xmlns:schedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
xmlns:templates ="clr-namespace:com.XXX.MyApp.Views.PhoneTemplates"
xmlns:c="clr-namespace:com.XXX.MyApp.Views.Common"
xmlns:material="clr-namespace:com.XXX.MaterialForms;assembly=com.XXX.MaterialForms.Standard"
Title="{Binding Title}"
BackgroundImage="background.png"
xmlns:syncfusion="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms">
What do I need to do or change to get this to work?
I'm trying to follow the example as shown here:
https://help.syncfusion.com/xamarin/sfschedule/schedule-theme
One additional bit of info gathered:
01-18 13:41:03.385 E/AppCenterCrashes( 4994): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not resolve type with token 01000103 (from typeref, class/assembly Syncfusion.SfSchedule.XForms.SfScheduleStyles, Syncfusion.SfSchedule.XForms, Version=16.4451.0.47, Culture=neutral, PublicKeyToken=null)
01-18 13:41:03.385 E/AppCenterCrashes( 4994): at com.XXX.MyApp.PhoneViews.CalendarPage..ctor () [0x00008] in C:\srclib\XXX\Mobile\Applications\MyApp\MyApp\MyApp\PhoneViews\Appointments\CalendarPage.xaml.cs:21
*** UPDATE ***
--------------------------------------------
Note - I am not able to reply or reply with quote to your solution/response. I am unable to get the checkbox for "I am not a robot" to respond or become checked. You might want to check this over. - Curtis
Hi Curtis,Thanks for contacting Syncfusion support.We have analyzed the reported issue “TargetInvocationException occurs when trying to customize the default theme” and it is working fine from our side. we have ensured with customizing the default theme in simple sample and we have ensured the same with the attached sample on the UG documentation. We suspect that you didn’t set the Xamarin.Forms version as 3.0 or above as we haven mentioned in our UG documentation. Kindly check the Xamarin.Forms version. We have prepared sample for the same, please find the sample by the following link.Sample link: ScheduleThemingIf the issue remains same even after updating to the Xamarin.Forms version as mentioned, kindly revert us by modifying the provided sample based on your scenario. It will be helpful for us to look on it and provide you appropriate solution.Regards,
Subburaj Pandian V
--------------------------------------------
Note - It was difficult to reply or reply with quote to your solution/response. After some experimentation, I found that I had to rapidly/repeatedly click the "I am not a robot" checkbox (like 20 times) to get it to respond or become checked. You might want to look into this.
Thanks!
- Curtis