This is a migrated thread and some comments may be shown as answers.

Reactive view host System.TypeInitializationException

18 Answers 172 Views
Chart - Xamarin.Android
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 02 Feb 2017, 08:18 AM
UI for XAMARIN I'm trying to implement cahrt with xamarin android but reactive view host throw some exception : [ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ReactiveUI.ControlFetcherMixin' threw an exception. ---> System.ArgumentException: An item with the same key has already been added

18 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 07 Feb 2017, 09:08 AM
Hello Deepak,

Thank you for contacting us. Could you please provide a sample that reproduces the issue?

I look forward to your reply.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deepak
Top achievements
Rank 1
answered on 07 Feb 2017, 01:48 PM

Hi Rosy,

Actually I get UI Elements like : private ListView ListControls => this.GetControl<ListView>(); using ReactiveUI 

It's was working fine earlier but when I added telerik dll's references it's started giving System.TypeInitializationException

Example :

using Android.App;
using Android.Content;
using Android.Widget;
using Android.OS;
using ReactiveUI;

namespace Samples
{
[Activity (Label = "@string/title_activity_main", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : ReactiveActivity
{
        private ListView ListControls => this.GetControl<ListView>();
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            //this.listControls = (ListView) this.FindViewById(Resource.Id.listControls);
            this.ListControls.Adapter = new ControlsAdapter(this, 0);
            this.ListControls.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                ControlActivity.selectedControl = (ExamplesProvider)ListControls.Adapter.GetItem(e.Position);

                Intent examplesActivity = new Intent(this, typeof(ControlActivity));
                this.StartActivity(examplesActivity);
            };
        }
    }
}

0
Deepak
Top achievements
Rank 1
answered on 07 Feb 2017, 02:18 PM
related exception : 
0
Rosy Topchiyska
Telerik team
answered on 07 Feb 2017, 02:30 PM
Hi Deepak,

Could you please check what is the version of AppCompat support library in your app. Our components support version 23 and if you use a higher version, this could cause problems.

I look forward to your reply.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deepak
Top achievements
Rank 1
answered on 07 Feb 2017, 03:07 PM
I'm using Appcompact version : 23.0.1.3
0
Deepak
Top achievements
Rank 1
answered on 09 Feb 2017, 06:35 AM
I'm still having this issue ...help me to resolve this, please
0
Deepak
Top achievements
Rank 1
answered on 09 Feb 2017, 12:03 PM

Hi Rosy,

I just checked all other Xamarin Android dll's other than "Telerik.Xamarin.Android.Chart" .... all working fine So I think this issue is only with Telerik.Xamarin.Android.Chart dll.... if you found anything, please let me know.. I'm stuck :(

0
Rosy Topchiyska
Telerik team
answered on 09 Feb 2017, 12:09 PM
Hi Deepak,

Thank you for the sample, but we will need more details to reproduce the issue on our side. Could you please prepare a sample application?

I look forward to your reply.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deepak
Top achievements
Rank 1
answered on 09 Feb 2017, 01:05 PM

Hi Rosy,

Please find the sample application at : https://drive.google.com/file/d/0B9rB5PUbyfdsZ2EzY21FR2phc3M/view?usp=sharing

This is my sample project. If you will run this you can see the issue.

Step 1: If you run the project with "Telerik.Xamarin.Android.Input.dll" and "Telerik.Xamarin.Android.Chart.dll" then it'll produce the                    exception(currently I've added these dll's with the sample project).

Step 2: If you remove the "Telerik.Xamarin.Android.Input.dll" and "Telerik.Xamarin.Android.Chart.dll" and run the project then it'll                      work fine.

Please have a look into it. I've to complete my project ASAP.

Thanks

0
Deyan
Telerik team
answered on 09 Feb 2017, 03:05 PM
Hi Deepak,

Just a quick question:

While using Chart and Input DLLs, did you add also a reference to the Common and Primitives DLLs, as both depend on them as described here:

http://docs.telerik.com/devtools/android/download-and-deployment/installation-contents-and-dependencies



Regards,
Deyan
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deepak
Top achievements
Rank 1
answered on 09 Feb 2017, 04:17 PM
Yes I did
0
Deepak
Top achievements
Rank 1
answered on 09 Feb 2017, 04:29 PM

Hi Deyan,

You can see this in the sample project that I've shared 

0
Deyan
Telerik team
answered on 14 Feb 2017, 01:58 PM
Hi Deepak,

Thanks for writing back.

We're currently investigating the case. We have narrowed it down to a specific assembly from the UI for Xamarin.Android suite and will get back to you as soon as we have more information to share.

Thanks for your patience.

Regards,
Deyan
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deyan
Telerik team
answered on 15 Feb 2017, 09:39 AM
Hi Deepak,

This is a quick follow-up with some more information on the case.

After downloading the ReactiveUI source code and debugging it locally, we have determined that there is a potential issue with ReactiveUI's source which causes this exception. A specific part of ReaciveUI's implementation merges Android resource IDs into a Dictionary without considering the possibility of duplicate dictionary keys. When you reference the Telerik UI for Xamarin.Android assemblies there are two resource IDs which are the same but with different casing. ReactiveUI's code doesn't consider the casing and sees them as two identical resource IDs which leads to an attempt to insert an item into this Dictionary which has a key that already exists. This causes the exception.

We will contact ReactiveUI's team to inform them about this case and discuss a possible solution.

This is currently all we can do.

Let us know if you have additional questions.

Regards,
Deyan
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Deepak
Top achievements
Rank 1
answered on 16 Feb 2017, 05:20 AM

Hi Deyan,

Thanks for your support, If you find any solution then please let me know... I'm also working on it.

Thanks again.

0
Deepak
Top achievements
Rank 1
answered on 18 Feb 2017, 07:59 AM

Hi Deyan,

Thanks to you and your team for all the efforts that you guys have put.. can you please let me know that when the new release would be available?

0
Deyan
Telerik team
answered on 21 Feb 2017, 07:39 AM
Hello Deepak,

I cannot currently confirm when are we going to address this issue. If we are to address it on our side, it will imply introducing breaking changes which we are not fond of.

Please stay tuned for more information on that case.

Regards,
Deyan
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 05 Nov 2018, 12:47 PM

Hello,

I am having the same issues since upgrading to the latest version of ReactiveUI. The id's used in the Telerik control library conflicts with lower case variants. The stacktrace I'm receiving is:

 

System.TypeInitializationException: The type initializer for 'ReactiveUI.ControlFetcherMixin' threw an exception. ---> System.InvalidOperationException: You're using multiple resource ID's with the same name but with different casings which isn't allowed for WireUpControls: { Bottom = bottom }, { Date = date }, { Left = left }, { None = none }, { Right = right }, { Top = top }, { Visible = visible } ---> System.ArgumentException: An item with the same key has already been added. Key: bottom

 

Has there been any progress made on this? I can't see anything on ReactiveUI's GitHub page to suggest a ticket has been raised. 

Tags
Chart - Xamarin.Android
Asked by
Deepak
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Deepak
Top achievements
Rank 1
Deyan
Telerik team
Ian
Top achievements
Rank 1
Share this question
or