Xamarin Forms as well as Xamarin Native rely on the Mono runtime and framework for cross platform code sharing between iOS, Android, and UWP. This means that a .NET assembly will be generated for the solution and, on Android, will use JIT compiling on the device upon runtime to translate the C# code to native Android code (Apple restricts JIT compiling on device so AOT is implemented for iOS solutions, this will come into play later).
Since this process generates a .NET assembly, we can use standard .NET decompiler tools such as ILSpy to deconstruct the assembly and have a complete, in depth look at the source code. The following is how anyone could download a Xamarin Forms app from iTunes/App Store or Google Play, extract the .NET assembly, and decompile it to view the entire source code.
iOS (Requires a Mac)
[UPDATE 9/28/17: Apple has removed the ability to download apps through the latest version of iTunes, so this method no longer works. It may continue to work on versions prior to version 12.7, but I haven’t tested this.]
[UPDATE 10/9/17: Apple has now reinstated the App Store functionality in iTunes 12.6.3. Odd move by Apple to bring it back just 2 weeks later. If you are already running 12.7, you will need to download and install 12.6.3 from here: https://support.apple.com/en-gb/HT208079]
-Open up iTunes
-Search iTunes for a Xamarin Forms app. Hit Get and then Download. The downloaded .IPA file will be found under ~/Music/iTunes/iTunes Media/Mobile Applications/
-Copy the IPA file to a temporary directory on your desktop. Rename the .ipa to app.ipa.
-In Terminal, cd into that directory and enter in unzip app.ipa. Wait until the unzip finishes.
-Open up the Payload folder and right click on AppName.iOS. Click on Show Package Contents.
-In the Finder search bar, enter in .dll. This will locate all the DLLs in the project. Find the AppName.dll file and copy it to a flash drive. We will need to decompile this dll on a Windows machine.
Android (Mac or Windows; I tested this on a Mac)
-Since we cannot directly download the .apk from the Play Store, we need to use a frontend client to download the apk for us. I used Raccoon (http://raccoon.onyxbits.de/)
-Download and open up raccoon using Terminal (java -jar raccoon.jar). Login to a Google account when prompted. Choose “Let Raccoon create a pseudo device”.
-Search for a Xamarin Forms app in the search bar. Once you have found it, hit download. Once downloaded click on show where the file was downloaded to.
-Copy the .apk to the desktop. Again use a temporary folder and run the command unzip in terminal. On Windows you could probably use 7-Zip to do this.
-Open the assemblies folder and copy AppName.dll and AppName.Droid.dll on to a flash drive for the next step of decompiling the DLLs.
DLL Decompile (Windows)
-Unzip it and run ILSpy.exe
-Click open and select the DLLs you want to decompile
-View the source of the DLLs