Search code examples
xamarinxamarin.iosxamarin.formsxamarin.uwp

Xamarin.Forms.Forms.Init(e) FileNotFoundExeception in Onlaunched


My Android Application works fine but when I launch my UWP application it crashes in the OnLaunched of my App.xaml.cs at the line of Xamarin.Forms.Forms.Init(e)

This is the error I'm getting:

System.IO.FileNotFoundException: 'Could not load file or assembly 'clrcompression, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'

It completely makes my app crash, only thing I can see is my Splashscreen.

In IOS got a similar issue. It also show an error of FileNotFoundexception but it doesn't break and I can go past it. It show the error in my Main.cs at the line of UIApplication.Main(args, null, "AppDelegate");


Solution

  • As discussed in the comments of the original post, and for anyone else that stumbles accross this thread with the same exception, in most instances the cause would appear to be related to Xlabs assemblies either not loading correctly, or having not been removed completely. This appears to have been an issue for at least the last half a year (past example of similar situation can be found Here).

    The solution in this instance if you removed the xlab references but still get the error, is to delete the obj/bin/.VS folders from your project folder. Then for a UWP project, rebuild and then deploy. The issue should be resolved.