Wednesday, December 10, 2014

Invalid IL code in system.xml.linq.xdocument:Parse (string): method body is empty

Working on getting a iPhone application off the ground.  We are using Xamarin/Monotouch and MVVMcross to build a cross platform solution.  The PCL does not support File.IO namespace so using some excellent posts about IoC.

Problem:

An issue cropped up in my attempts to get my example working.  I have the xml file being rendered in the iOS project of the solution.  The Interface is stored in the PCL and it compiles and runs.  But when I hit the line in the iOS project

doc = XDocument.Parse(DefaultData);

I got the runtime error:
Invalid IL code in system.xml.linq.xdocument:Parse (string): method body is empty

Solution:

The iOS project is using the Monotouch namespace which includes its own copies of the common
.Net dlls.  It appears that the namespaces for the non mono projects were included as references for the iOS project.  This meant that the source code would compile without errors.  The dll in question was System.XML.dll.  I dropped the reference to this dll and added in the correct mono dll and that removed the IL error.


Wrong System.XML.dll file

Program Files(x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.XML.dll

vs.


Correct System.XML.dll

Program Files(x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0\System.XML.dll

Thursday, December 4, 2014

Xamarin Build server with address 192.168.x.x is too old to be used with this version of Xamarin.iOS extension

Problem:

In Visual Studio, I try to connect to the Xamarin Build Host on my Mac.  VS flags an error when I try to compile.  This event occurs when I try to connect to the Build Host.  The error states that my Mac version of Xamarin is to old. 

Try 1:
My obvious conclusion was to update the Mac system to the latest version of Xamarin and try again.
I did this and it did not work.  I installed the update and rebooted the Mac.  I tried to connect from Visual Studio and still got the error.

Try 2:
My next thought was to update my build box which hosts Visual Studio.  I did the update to the most current version of Xamarin Studio which will include the Build Host.  The error was still present following install and reboot.  This is really getting annoying.

Solution:

I took a step back and looked at my Windows dev system and ignored the error message from Xamarin.  I looked at the log files and noted that there was mention of the machine not being reachable.  This got me wondering and I began looking at Network issues. 

I opened up IE > Internet Options > Connections > LAN Settings

There was the problem!!!  The Proxy server check box was selected.  This meant that all my traffic was going through a static connection and not using DHCP.

Fix was to unselect Use Proxy Server checkbox and Select the Automatically detect settings checkbox.

Notes:
The problem with this error is that error message does not alert you to the fact that it is a networking issue.  I had to look at the logs to determine the issue.