InitializeComponent () is too complex

radkapperadkappe Member ✭✭

Hi,

I am currently developing an App for IOS and Android with Xamarin Forms. I am debugging with my Android device.

Starting yesterday, when trying to build and test my solution, it falls into a break state before the App is even loaded.

The exception is:

System.InvalidProgramException: Method wuut.Discover:InitializeComponent () is too complex.

It works when I unplug my Android device and open the App on developer mode. But I really need the Console etc. so right now, I am unable to continue developing my app.

I looked up the exception on Google but couldn't really find anything similar to my problem.

The error occurs inside InitializeComponent on one of my Contentpages containing an AbsoluteLayout.

The AbsoluteLayout is rather big with 5400 Lines of Code. So looking into the error messages, I tried to remove a few chunks of my XAML and it started working again.

So my question is: Does XAML or Xamarin have some limitations on how big an AbsoluteLayout/Contentpage should be? If not, how would I resolve this issue?

Thanks in advance and kind regards

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    The AbsoluteLayout is rather big with 5400 Lines of Code.

    WTF? I've got some rather complex views... Views that fill a 24" monitor page when the app is running, without much whitespace. And they don't come near that. I've never seen a layout like that - not when doing point of sale systems, navigation systems, or radio station booth software. I can't even imagine something like that...

    UNLESS

    It is just filled with tons and tons of repetitive markup instead of assigning styles and other good practices. Maybe there is a bunch of repetition that could be turned into custom controls? So instead of 100 lines 5 times, you just have 5 uses of a given control?

    Please don't dump it all in the thread... But I'd sure love to see maybe 100-200 lines of a typical section that is a fair example of what it all looks like.

  • NMackayNMackay GBInsider, University mod

    5400.....sounds a tad complex (imagine the native rendering underneath), if nothing else, I'd be splitting the page up into components (Content/PartialViews) to make it more manageable. Just sounds like a maintenance nightmare.

Sign In or Register to comment.